代码如下:class Student {
public int studentid;
public String name;
public int birthday;
public String department;
public String girlfriend;
public void getInfo() {
System.out.println("studentid+name+birthday+department+girlfriend");
}
}
class Undergraduate extends Student {
public String counsler;
public void getInfo() {
System.out.println("counsler");
}
}
class Graduate extends Student {
public String supervisor;
public void getInfo() {
System.out.println("supervisor");
}
}
class test {
void main() {
{
Undergraduate Zhong = new Undergraduate();
Zhong.name = "小明";
Zhong.birthday = 2002201;
Zhong.studentid = 55;
Zhong.department = "信息学院";
Zhong.girlfriend = "小红";
Zhong.counsler = "琳琳";
Zhong.getInfo();
}
}
}
题目和运行结果在这
我调到心灰意冷了😭