public class Person implements Comparable<Person>{
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
@Override
public String toString() {
return "name=" + name + ", age =" + age;
}
@Override
public int compareTo(Person o) {
// TODO Auto-generated method stub
return this.age - o.age > 0? 1:-1;
}