Have you ever felt over loaded with work? Here is something to cheer you up …
package com.twisters;Got an answer? Why don’t you leave it here.
class Base{}
public class Child extends Base{
public boolean equals(Base b){
return false;
}
public static void main(String[] args) {
Base base;
Child child;
child = new Child();
base = child;
if(child.equals(base))
System.out.println("Child Equals Base");
if(base.equals(child))
System.out.println("Base Equals Child");
}
}
No comments:
Post a Comment
Solution for this question?