62,614
社区成员
发帖
与我相关
我的任务
分享
abstract class Father {
private void test() {
System.out.println("this is Father.test()");
}
abstract void show();
Father() {
System.out.println("this is Father.Father()");
show();
test();
}
}
public class Child extends Father {
int radius;
void show(){
System.out.println("this is Child.show(),radius = " + radius);
}
Child(int r){
radius = r;
show();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new Child(7);
}
}
this is Father.Father()
this is Child.show(),radius = 0
this is Father.test()
this is Child.show(),radius = 7