if you going to use Generic then you class look like this
class Person implements Comparable<Person> {
private String fName;
private String lName;
private Integer age;
public int compareTo(Person o) {
int thisCmp = age.compareTo(o.age);
return (thisCmp != 0 ? thisCmp : lName.compareTo(o.fName));
}
}
if you are not using Generic then your class look like
class Person implements Comparable {
private String fName;
private String lName;
private Integer age;
public int compareTo(Object obj) {
Person o= (Person) obj;
int thisCmp = age.compareTo(o.age);
return (thisCmp != 0 ? thisCmp : lName.compareTo(o.fName));
}
}