package com.itheima.stu.extend;
classFatherextendsObject{
publicFather(){
//super();
System.out.println("Father 的构造方法");
}
}
classSonextendsFather{
publicSon(){
super(); //这是一条语句,如果不写,系统会默认加上,用来访问父类中的空参构造
System.out.println("Son 的构造方法");
}
}
publicclassDemo5_Extends{
publicstaticvoid main(String[] args){
Son s =newSon();
}
}
|
|