Sortable Interface Example
There are 4 files to look at to understand this example.
The interface Sortable is defined in Sortable.java.
The Points class, which fills the array to be sorted, is in Points.java.
The driver, which sets up the array of Points, and calls the sort routine, is in PointTest.java.
The sorting routine itself, bubbleSort in this case, is in MyArrays.java.
Note that I have written my own interface here, called Sortable, so that I can show it to you, instead of using the Comparable interface defined in the Java API.