A class implements the
Comparable interface when
its objects are expected to be arranged into a particular order.
For example, the class
because strings are often compared with each other and arranged into alphabetical order.
Numeric classes (such as
Comparable since number are often sorted into numeric order.
This chapter describes the Java 5.0 version of
which uses generics.
Earlier versions of Java are somewhat different.
Arrange these strings into order: "orange", "apple", "plum".