本帖最后由 fei9ci 于 2016-3-21 23:08 编辑
class Test{
public static void main(String[] args) {
Son s = new Son();
s.show();
s.speak();
}
}
class Father {
int num1 = 1;
public void speak() {
System.out.println("i am father");
}
}
class Son extends Father {
public void show() {
System.out.println(num1 + "son");
}
}
运行结果
1son
i am fathe
|