67,512
社区成员
发帖
与我相关
我的任务
分享
public class B {
public static void main(String[] args) {
B b1 =new B();
B b2 =new B();
System.out.println(b1.equals(b2));
System.out.println(b1==b2);
}
}
public class B {
String s;
@Override
public boolean equals(Object obj) {
//在这里面代码随意写
return true;
}
@Override//跟这个方法类似
public int hashCode() {
return 11111;
}
public static void main(String[] args) {
B b1 = new B();
B b2 = new B();
System.out.println(b1==b2);
System.out.println(b1.equals(b2));
}
}
[/quote]
恩。我知道了
public class B {
String s;
@Override
public boolean equals(Object obj) {
//在这里面代码随意写
return true;
}
@Override//跟这个方法类似
public int hashCode() {
return 11111;
}
public static void main(String[] args) {
B b1 = new B();
B b2 = new B();
System.out.println(b1==b2);
System.out.println(b1.equals(b2));
}
}
public class B {
@Override
public int hashCode() {
return 11111;
}
public static void main(String[] args) {
B b1 = new B();
B b2 = new B();
System.out.println(b1==b2);
System.out.println(b1.equals(b2));
}
}