← Quiz: Comparable vs Comparator: all 10 questions
Quiz: Comparable vs Comparator · Question 1 of 10
What does a negative return value from compare(a, b) mean?
What does a negative return value from compare(a, b) mean?
- A.a comes before b
- B.a comes after b
- C.a and b are equal
- D.The comparison failed
Answer & explanation
Correct answer: a comes before b
Negative means a sorts first; only the sign is important.
Can you get the rest right without peeking?
Take the timed Quiz: Comparable vs Comparator quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →