go to previous page   go to home page   go to next page

Answer:

No. The primitive boolean has been left out. But it would never be used if it existed.


Arrays.sort( Object )

Inspect this method:

   
static void sort(Object[] a)           

Recall that Object is the ancestor of all objects in Java.

An array of object references can be sorted as long as all references point to objects that implement the Comparable interface. The only method in this interface is the compareTo() method.


QUESTION 13:

If a class has a compareTo() method in it, is that enough to work with Arrays.sort() ?


go to previous page   go to home page   go to next page