67
phone = telephone;
}
public String toString () { return lastName + ", " +
firstName + "\t" + phone;}
public boolean equals (Object other) {
return
(lastName.equals(((Contact)other).getLastName()) &&
firstName.equals(((Contact)other).getFirstName()));
}
public String getFirstName () {return firstName; }
public String getLastName () {return lastName;}
public int compareTo (Object other)
{
int result;
String otherFirst =
((Contact)other).getFirstName();
String otherLast = ((Contact)other).getLastName();
if (lastName.equals(otherLast))
result = firstName.compareTo(otherFirst);
else
result = lastName.compareTo(otherLast);
return result;
}
}
Достарыңызбен бөлісу: