public class Main {
static void method(A a){
System.out.print("one");
}
static void method(B b){
System.out.print("two");
}
static void method(Object obj){
System.out.print("three");
}
public static void main(String[] args) {
C c = new C();
method(c);
}
}
class A {}
class B extends A{}
class C extends B{}
As you see the title, i think it displays "three" but true answer is "two". Anyone can explain me? Thankss!