Question 20
Back to Exercise
Which property does Arrays.sort guarantee when sorting an array of objects (e.g. String[])?
- A It is unstable
- B It is stable: equal elements keep their relative order Correct
- C It sorts in descending order
- D It only works on primitives
Correct Answer: Option B
Objects use TimSort (stable); primitives use dual-pivot quicksort, where stability does not matter.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!