You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
563 B

package w5挑战版;
// 学生
public class Student extends Person {
private String studentId; // 学号
public Student(String name, int age, String studentId) {
super(name, age);
this.studentId = studentId;
}
// 重写显示信息
@Override
public void showInfo() {
System.out.printf("【学生】%s | 年龄:%d | 学号:%s%n", getName(), getAge(), studentId);
}
// 🔥 必须加这个getter!否则PersonManager里调用不到
public String getStudentId() {
return studentId;
}
}