public class Person {
int age;
String name;
public Person(int age , String name){
this.age = age;
this.name = name;
}
}
public class Student extends Person{
String address;
public Student(int age, String name, String address) {
super(age, name);
this.address = address;
}
}
学生类继承人类,使用super去调用父类的构造函数。如果子类没有调用父类的构造函数的话就调用父类的默认构造函数