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:

This chapter describes the Java 5.0 version of Comparable, which uses generics. Earlier versions of Java are somewhat different.

QUESTION 1:

Arrange these strings into order: "orange", "apple", "plum".