beginJsp2.0外文书籍源代码
源代码在线查看: user2.java
package com.wrox.utilities;
public class User2 implements Comparable
{
String userName;
String phoneNumber;
public User2(String userName, String phoneNumber)
{
this.userName = userName;
this.phoneNumber = phoneNumber;
}
public boolean equals(Object o)
{
if (o instanceof User2)
{
User2 user = (User2) o;
if (user.getUsername().equals(this.userName)) return true;
}
return false;
}
public int compareTo(Object o)
{
User2 user = (User2) o;
return (this.getUsername().compareTo(user.getUsername()));
}
public void setUsername(String userName)
{
this.userName = userName;
}
public String getUsername()
{
return userName;
}
public void setPhoneNumber(String phoneNumber)
{
this.phoneNumber = phoneNumber;
}
public String getPhoneNumber()
{
return phoneNumber;
}
}