class Person {
private String name;
private int age;
public Person() {
}
public Person(String name) {
this();
this.name = name;
}
public Person(String name, int age) {
this(name);
this.age = age;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return this.name;
}
public int getAge() {
return this.age;
}
}
class Student extends Person {
private String school;
public Student() {
super();
}
public Student(String name) {
super(name);
}
public Student(String name, int age) {
super(name,age);
}
public Student(String name, int age, String school) {
super(name,age);
this.school = school;
}
public void setSchool(String school) {
this.school = school;
}
public String getSchool() {
return this.school;
}
}
public class TestDemo {
public static void main(String[] args) {
Student s = new Student();
s.setName("北方南");
s.setAge(1);
s.setSchool("幼稚园");
System.out.println("姓名:" + s.getName() +" 年龄:" + s.getAge()
+ " 学校:" + s.getSchool());
}
}