The Comparable Interface Type
- object1.compareTo(object2) returns
- Negative number if object1 less than object2
- 0 if objects identical
- Positive number if object1 greater than object2
- sort method compares and rearranges elements
if (object1.compareTo(object2) > 0) . . .
- String class implements Comparable<String>
interface type: lexicographic (dictionary) order
- Country class: compare countries by area
Ch4/sort1/Country.java
Ch4/sort1/CountrySortTester.java