1 /**
2 A person with a name.
3 */
4 public class Person implements Comparable<Person>
5 {
6 private String name;
7
8 /**
9 Constructs a Person object
10 @param aName the name of the person
11 */
12 public Person(String aName)
13 {
14 name = aName;
15 }
16
17 public String toString()
18 {
19 return getClass().getName() + "[name=" + name + "]";
20 }
21
22 public int compareTo(Person other)
23 {
24 return name.compareTo(other.name);
25 }
26 }