62,623
社区成员
发帖
与我相关
我的任务
分享Student1 stu=(Student1)obj;
if(this.age==stu.age&&this.name==stu.name)
return true;
else
return false; 这部分就不会执行了
if(obj==null)
return false;
if(obj==this)
return true;
if(obj instanceof Student1)
{
Student1 stu=(Student1)obj;
return stu.age==this.age && stu.name.equals(this.name);
}
else
return false;
} public int hashCode(){
int hash=1;
hash=hash+31*age;
hash=hash+29*(name==null?0:name.hashCode());
return hash;
}