A:看下面程序是否有问题,如果没有,说出结果
class Fu {
public void show() {
System.out.println("fu show");
}
}
class Zi extends Fu {
public void show() {
System.out.println("zi show");
}
public void method() {
System.out.println("zi method");
}
}
class Test1Demo {
public static void main(String[] args) {
Fu f = new Zi();
f.method(); //父类中没有method方法,不能通过编译,所以报错
f.show(); //输出 zi show
}
} |
|