Code
interface X{
void m1();
void m2();
}
class Child2
extends Object implements X
{
public void m1(){
System.
out.
println("Child2 M1");
}
public void m2(){
System.
out.
println("Child2 M2");
}
}
public class ParentChildInfterfaceDemo {
public static void main
(String[] args
){
X x = new Child2();
X x1 = new Child2();
x.m1();
x.m2();
x.equals(x1);
}
}
Copyright GeekInterview.com
will this code work and if yes then why is x.equals(x1) work? Can you please explain?
Can a reference variable of Interface calls and equals method of Object call? If so, why?
will this code work and if yes then why is x.equals(x1) work? Can you please explain?
Questions by kool.bird9 answers by kool.bird9
Related Answered Questions
Related Open Questions