Suppose a developer gets class XYZ files and documentation from a subcontractor. This class does not implement the Comparable interface. What must be true in order for the developer to sort an array of XYZ objects without modifying the xyz class?a. The developer must supply a comparator object belonging to a class that implements the Comparator interface.b. XYZ objects must be randomly distributed.c. The XYZ class must implement the Sortable interface.d. XYZ objects must be ordered.

Respuesta :

ijeggs

Answer:

A) The developer must supply a comparator object belonging to a class that implements the Comparator interface

Explanation:

The comparator interface handles the ordering (sorting) of user-defined classes, it does this by comparing two different objects from different classes. The comparator interface works by accepting a method which extracts a key for sorting of a type say N, and returns a comparator that compares to N, it therefore compares the object (current one) with the specified one