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); } }
点赞 评论

相关推荐

09-14 16:06
闽江学院 Java
点赞 评论 收藏
分享
牛客网
牛客企业服务