This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
It is mentioned on page 556(exam watch) in K&B book, about sorting of collection and arrays, the elements should be mutuable comparable. What does this mean, i have created an object of Car and stored all same object of it into Object.
In class Car, i have not implemented any Comparable, or not a separate class with Comparator. Hence when i try to call Array.sort(objects).. it gives ClassCastException.
But when i implement one a Comparable interface, it works fine, does it mean that "if two objects elements are said to be mutually comparable in a collection (TreeSet) or in an array (Object), if they implement Comparable interface".