System.out.println(Arrays.toString(nums));
A. [1, 9, 10]
B. [1, 10, 9]
C. [10, 1, 9]
D. None of the above
Answer:B
System.out.println(Arrays.toString(nums));
A. [1, 9, 10] B. [1, 10, 9] C. [10, 1, 9] D. None of the above
Explanation: The elements of the array are of type String rather than int. Therefore, we use alphabetical order when sorting. The character 1 sorts before character 9, alphabetically making Option A incorrect. Shorter strings sort before longer strings when all the other characters are the same, making Option B the answer.