/** Example from Core Java 8th edition by Horstmann and Cornell extended for Interface demonstration. Implementing java.lang.Comparable interface. @author A. Ozgelen */ public abstract class Person implements Comparable { public Person(String n){ name = n; } // abstact method. derived classes must define this method // otherwise they have to declare themselves abstract as well. public abstract String getDescription(); public int compareTo(Object other) { Person p = (Person) other; return name.compareTo(p.getName()) ; } public String getName() { return name; } private String name ; }