标题: 多态面试题 [打印本页] 作者: 糊图 时间: 2016-6-30 23:42 标题: 多态面试题 class A {
public void show() {
show2();
}
public void show2() {
System.out.println("我");
}
}
class B extends A {
public void show() {
show2();
}
public void show2() {
System.out.println("爱");
}
}
class C extends B {
public void show() {
super.show();
}
public void show2() {
System.out.println("你");
}
}
public class Test2DuoTai {
public static void main(String[] args) {
B b = new C();
b.show();
}
}