Computer Science, asked by ravvarapusaivignesh, 10 hours ago

To which of the following can the sort method in Arrays class be applied?
O Array of objects
O Array of primitive data types
O Both options

Answers

Answered by hemakumar0116
0

Answer:

Both options

Explanation:

Both options

The class Arrays has static methods for sorting arrays of both basic and object kinds. Arrays can be sorted as a whole or just within a certain range.

Using the sort() method and a comparison function to establish the order of the objects in the array, you may sort an array of objects.

Java's Arrays. sort function may be used to arrange an array of objects, and by having the class implement the Comparable interface, the class's items will be ordered naturally.

For object Collections like ArrayList, LinkedList, etc., sort() is effective. By using the reverse order technique, the array will be sorted in descending order. The reverseOrder() method of the Java Collections class allows you to sort an array in reverse lexicographic order.

#SPJ3

Similar questions
Math, 8 months ago