class Person{
private String name;
private String gender;
private int age;
Person(){}
Person(String name){
this();
this.name=name;
}
Person(String name,String gender){
this(name);
this.gender=gender;
}
Person(String name,String gender,int age){
this(name,gender);
this.age=age;
}
public void setName(String name){
this.name=name;
}
public String getName(){
return this.name;
}
public void setGender(String gender){
this.gender=gender;
}
public String getGender(){
return this.gender;
}
public void setAge(int age){
this.age=age;
}
public int getAge(){
return this.age;
}
void say(){
System.out.println("姓名:"+this.name+"\n性别:"+this.gender+"\n年龄:"+this.age);
}
}
class Student extends Person{
private String school;
Student(String name,String gender,int age,String school){
super(name,gender,age);
this.school=school;
}
public void setSchool(String school){
this.school=school;
}
public String getSchool(){
return school;
}
void say(){
super.say();
System.out.println("毕业学校:"+this.school);
}
}
public class Test {
public static void main(String[] args) {
Student stu1= new Student("张三","男",33,"清华大学");
stu1.say();
}
}