class A {}
class B extends A { void eat(A a) { System.out.println("Eat A"); } }
public class C extends B
{
void eat(A a) { System.out.println("Eat A"); }
void eat(B b) { System.out.println("Eat B"); }
void eat(C c) { System.out.println("Eat C"); }
public static void main(
String... args)
{
A a = new C();
B b = new C();
b.eat(a);
}
}
The output of this code is "Eat A".
I don't understand this - I would have expected the output to be "Eat C.