class Student {     String name;     int age;          public void Student(String name,int age) {         this.name = name;         this.age = age;     }          public void show () {         System.out.println("学生姓名:"+this.name+" 学生年龄:"+this.age);     } } class Undergraduate extends Student {     String degree;          public void Undergraduate(String name,int age,String degree) {         super.Student(name,age);         this.degree = degree;     }          public void show () {         System.out.println("学生姓名:"+this.name+" 学生年龄:"+this.age+" 学生学位:"+this.degree);     } } public class StudentDemo {     public static void main(String[] args) {         Student s = new Student();         s.Student("小红",24);         s.show();                  Undergraduate u = new Undergraduate();         u.Undergraduate("小红",24,"硕士");         u.show();     } }
点赞 评论

相关推荐

点赞 评论 收藏
分享
球球别再泡了:坏,我单9要了14
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客企业服务