1. You wouldn't sort a class. You would build a collection of the class's instances, then sort the collection. It would be up to you to define how the comparison for sorting is done, by overriding the equals() method.
The equals() method isn't going to help with sorting. Instead, look at the Comparable and Comparator interfaces, and at the static method java.util.Arrays.sort() .