62,614
社区成员
发帖
与我相关
我的任务
分享
Integer n1=new Integer(13);
Integer n2=new Integer(13);
System.out.println(n1.equals(n2)); //true
view plaincopy to clipboardprint?
public boolean equals(Object obj) {
return (this == obj);
}
view plaincopy to clipboardprint?
public boolean equals(Object obj) {
if (obj instanceof Integer) {
return value == ((Integer)obj).intValue();
}
return false;
}