62,616
社区成员
发帖
与我相关
我的任务
分享
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (this.getClass() != other.getClass()) {
return false;
}
return EqualsBuilder.reflectionEquals(this, other, false);
}
obj1.getClass().getSuperclass() == obj2.getClass().getSuperclass()
判断public class Hello {
private int sn;
@Override
public boolean equals(Object other) {
// [[1]]
if (other == null) {
return false;
}
// [[2]]
if (this.getClass() != other.getClass()) {
return false;
}
// [[3]]
Hello o = (Hello) other;
return this.sn == o.sn;
}
public static void main(String[] args) {
}
}