日期:2014-05-20 浏览次数:20764 次
public class People { private int id;//联系人id private String name;//联系人姓名 private String pass;//联系人密码 private String num;//联系人电话 public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } public String getNum() { return num; } public void setNum(String num) { this.num = num; } public People(int id,String name,String pass,String num){ this.id=id; this.name=name; this.pass=pass; this.num=num; } }
@Override public boolean equals(Object obj) { if(obj == null) { return false; } else if(obj.getClass() == this.getClass()) { People p = (People)obj; return p.id == this.id; } return false; } @Override public int hashCode() { int type = this.getClass().hashCode(); return id + type*41; }