Multiple choice technology web technology

Comparable interface needs to be implemented to do the sorting

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To enable natural sorting of a collection of custom objects (e.g., using Collections.sort()), the class must implement the Comparable interface and override its compareTo method. Alternatively, a Comparator can be used, but implementing Comparable is the standard way to define natural ordering.