🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: HashMap and Maps: all 10 questions

Quiz: HashMap and Maps · Question 5 of 10

Which interface lets you define MANY different sort orders outside the class?

Which interface lets you define MANY different sort orders outside the class?

  1. A.Comparable
  2. B.Comparator
  3. C.Iterable
  4. D.Serializable
Answer & explanation

Correct answer: Comparator

Comparator objects define custom orders; Comparable defines one natural order inside the class.

Can you get the rest right without peeking?

Take the timed Quiz: HashMap and Maps quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →