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){ //A obj=new B();
return ("B and A");
}
public static void main(String[] args){
A a = new B();//多态
B b = new B();
System.out.println(a.show(b));
}
}
class D extends B {
}
这个运算结果是什么 原因 求大神指导 |
|