Ask Question

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.

+1
Answers (1)
  1. 21 November, 08:30
    0
    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Suppose a developer gets class XYZ files and documentation from a subcontractor. This class does not implement the Comparable interface. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers