Courseiva
Question 191 of 513
Working with Arrays and CollectionsmediumMultiple SelectObjective-mapped

1Z0-829 Working with Arrays and Collections Practice Question

Which two statements are true about the java.util.Comparator and java.lang.Comparable interfaces? (Choose two.)

⚠ Common exam trap

Candidates often confuse the return type of Comparator.compare (int) with a boolean, or mistakenly think Comparable forces an override of equals, when in fact only compareTo is required.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Comparator can be used to sort a list in multiple ways.

The Comparator interface allows you to define multiple different comparison strategies (e.g., by name, by age, by salary) for the same class, enabling sorting of a list in multiple ways. Option D is correct because the Comparable interface is used to define a natural ordering of objects (e.g., String's lexicographic order, Integer's numeric order) by implementing the compareTo method.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Comparator's compare method returns a boolean.

    Why it's wrong here

    False: compare returns an int.

  • Comparator can be used to sort a list in multiple ways.

    Why this is correct

    True: Multiple Comparators can define different orderings.

  • A class implementing Comparable must override equals().

    Why it's wrong here

    False: Only compareTo is required; overriding equals is optional.

  • Comparable is used to define a natural ordering of objects.

    Why this is correct

    True: Comparable defines natural ordering via compareTo.

  • Comparator is in java.lang package.

    Why it's wrong here

    False: Comparator is in java.util package.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.