50,541
社区成员
发帖
与我相关
我的任务
分享
public class Person {
public String name;
public int age;
public int id;
public Person(int j,String tom, int i) {
name=tom;
age=i;
id=j;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;
if (id != other.id){
return false;}
return true;
}
}