public class Test{ public static void main(String[] args) { Foo foo1 = new Foo(1); Foo foo2 = new Foo(2); System.out.print(foo1.equals(foo2)); } } class Foo { Integer code; Foo(Integer c) { code = c; } public boolean equals(Foo f) { return false; } public boolean equals(Object f) { return true; } }
public static void main(String[] args) {
Foo foo1 = new Foo(1);
Foo foo2 = new Foo(2);
System.out.print(foo1.equals(foo2));
}
class Foo {
Integer code;
Foo(Integer c) {
code = c;
public boolean equals(Foo f) {
return false;
public boolean equals(Object f) {
return true;
Oracle Certified Professional Java Programmer
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.