TestSuperSub

class SuperClass{
private int n;
SuperClass(){
System.out.println("SuperClass()");
}
SuperClass(int n){
System.out.println("SuperClass("+n+")");
this.n=n;
}

}
class SubClass extends SuperClass{
private int n;
SubClass(int n){
super();
System.out.println("SubClass("+n+")");
this.n=n;
}
SubClass(){
super(100);
System.out.println("SubClass()");
}
}
public class TestSuperSub {

public static void main(String[] args) {
// TODO 自动生成的方法存根
new TestSuperSub();
SubClass sc1=new SubClass();
SubClass sc2=new SubClass(200);

}

}

posted @ 2017-04-13 17:15  大仁哥汪宝  阅读(241)  评论(0编辑  收藏  举报