Cloneable and Comparable Interface Example


There are 2 files to look at to understand this example. The SortablePoints class implements two interfaces - Comparable and Cloneable.

The SortablePoints class is in SortablePoints.java.

The driver, which sets up the array of Points, and calls the sort routine, is in SortablePointTest.java.

The sorting routine itself used in this example is from the java array class in the java API.