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

相关推荐

10-13 17:47
门头沟学院 Java
wulala.god:图一那个善我面过,老板网上找的题库面的
点赞 评论 收藏
分享
牛客网
牛客企业服务