展开全部
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);
}
}
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);
}
}
追问
main函数呢?
追答
醉了,自己写个main函数就好了,然后调用下
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询