What does this code output?
String[] nums = new String[] { "1", "9", "10" }; Arrays.sort(nums); System.out.println(Arrays.toString(nums));
B.
The elements of the array are of type String rather than int.
Therefore, we use alphabetical order when sorting.
The character 1 sorts before the 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.