Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainClass
- {
- public static void main(String[] args)
- {
- Object a = new A();
- A b = new B();
- System.out.println(a.equals(b));
- }
- }
- public class A
- {
- public boolean equals (A other)
- {
- System.out.println("a");
- return true;
- }
- }
- public class B extends A
- {
- public boolean equals (Object other)
- {
- System.out.println("b");
- return true;
- }
- public boolean equals (B other)
- {
- System.out.println("c");
- return true;
- }
- }
Add Comment
Please, Sign In to add comment