java 编程 设计一个学生类

2020-06-25 教育 96阅读
public class Student {
String name;
int age;
public Student(String name, int age) {
this.name = name;
this.age = age;
}
public void show(){
System.out.println("学生name="+name+";学生age="+age);
}
}
class Undergraduate extends Student{

String degree;
public Undergraduate(String name, int age,String degree) {
super(name, age);
this.degree = degree;
}
public void show (){
System.out.println("学生name="+name+";学生age="+age+";学生degree="+degree);
}

}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com