created: 6/26/2006
CHAPTER 53B — Comparable Interface
A class implements the Comparable interface when
its objects are expected to be arranged into a particular order.
For example, the class String implements Comparable,
because strings are often compared with each other and arranged into alphabetical order.
Numeric classes (such as Integer or Double) implement
Comparable since number are often sorted into numeric order.
Chapter Topics:
- The Comparable Interface
comparable()method- natural order
- collating sequence
- sorting
- binary search
This chapter describes the Java 25 LTS version of Comparable,
which uses generics.
Earlier versions of Java are somewhat different.
QUESTION 1:
Arrange these strings into order: "orange", "apple", "plum".