黑马程序员技术交流社区
标题:
子类调用父类方法
[打印本页]
作者:
月影千华
时间:
2015-10-4 13:18
标题:
子类调用父类方法
class Father {
String s = "hello";
void show() {
System.out.println(s);
}
}
class Child extends Father {
String s = "world";
}
public class ExtendsTest {
public static void main(String[] args) {
Child c = new Child();
c.show();
}
}
复制代码
求结果 以及 解释....
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2