FileDocCategorySizeDatePackage
Name.javaAPI DocExample1036Tue Dec 12 18:59:40 GMT 2000None

Name

public class Name extends Object implements Comparable

Fields Summary
private String
firstName
private String
lastName
Constructors Summary
public Name(String firstName, String lastName)

        if (firstName==null || lastName==null)
            throw new NullPointerException();
        this.firstName = firstName;
        this.lastName = lastName;
    
Methods Summary
public intcompareTo(java.lang.Object o)

        Name n = (Name)o;
        int lastCmp = lastName.compareTo(n.lastName);
        return (lastCmp!=0 ? lastCmp :
                firstName.compareTo(n.firstName));
    
public booleanequals(java.lang.Object o)

        if (!(o instanceof Name))
            return false;
        Name n = (Name)o;
        return n.firstName.equals(firstName) &&
               n.lastName.equals(lastName);
    
public java.lang.StringfirstName()

return firstName;
public inthashCode()

        return 31*firstName.hashCode() + lastName.hashCode();
    
public java.lang.StringlastName()

return lastName;
public java.lang.StringtoString()

return firstName + " " + lastName;