最近刚学面向对象,遇到点问题不能理解
class A {
public String show(D obj)...{
return ("A and D");
}
public String show(A obj)...{
return ("A and A");
}
}
class B extends A{
public String show(B obj)...{
return ("B and B");
}
public String show(A obj)...{
return ("B and A");
}
}
class C extends B...{}
class D extends B...{}
A a1 = new A();
A a2 = new B();
System.out.println(a2.show(b)); ④ B AND A
System.out.println(a2.show(c)); B and A
求帮忙分析下这两句的调用过程