I have objects
Person{ String name; int age; float gradeAverage; }
Is there an easy way to sort
Person[]
Yes just implement the Comparable interface.
Comparable
Here's an example :
class Person implements Comparable { public int age; public String name; public int compareTo(Person other){ return this.age == other.age ? 0 : this.age > other.age ? 1 : -1; } }