public class Student {
public int age; //学生年龄
public String name; //学生姓名
public String degree; //学生学位
public void Student(int StudentAge, String StudentName)//得到姓名和年龄
{
this.name = StudentName;
this.age = StudentAge;
}
public static class Undergraduate extends Student{
public void Undergraduate(int StudentAge, String StudentName,String StudentDegree)
{
this.name = StudentName;
this.age = StudentAge;
this.degree = StudentDegree;
}
}
public void show() //打印学生信息
{
System.out.println("名字:"+this.name+"\n年龄:"+this.age+"\n学位:"+this.degree);
}
}