class A {
public void show() {
show2();
}
public void show2() {
System.out.println("我");
}
}
class B extends A {
pu;blic void show2() {
System.out.pritnln("爱");
}
}
class C extends B {
public void show() {
super.show();
}
public void show2() {
System.out.println("你");
}
}
public class ABC {
public static void main(String[] args) {
A a = new B();
a.show();
B b = new C();
b.show();
}
}
答案是:爱 你
但是这个语句的执行过程不是很清楚,感觉有些绕
|
|