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.
59 lines
1.1 KiB
59 lines
1.1 KiB
/**
|
|
* 学生:继承Person类,添加学生特有属性
|
|
*/
|
|
public class Student extends Person {
|
|
|
|
private String studentId; // 学号
|
|
private String major; // 专业
|
|
|
|
/**
|
|
* 无参构造方法
|
|
*/
|
|
public Student() {
|
|
}
|
|
|
|
/**
|
|
* 有参构造方法
|
|
* @param name 姓名
|
|
* @param id 身份证号
|
|
* @param studentId 学号
|
|
* @param major 专业
|
|
*/
|
|
public Student(String name, String id, String studentId, String major) {
|
|
super(name, id);
|
|
this.studentId = studentId;
|
|
this.major = major;
|
|
}
|
|
|
|
/**
|
|
* 获取学号
|
|
* @return 学号
|
|
*/
|
|
public String getStudentId() {
|
|
return studentId;
|
|
}
|
|
|
|
/**
|
|
* 设置学号
|
|
* @param studentId 学号
|
|
*/
|
|
public void setStudentId(String studentId) {
|
|
this.studentId = studentId;
|
|
}
|
|
|
|
/**
|
|
* 获取专业
|
|
* @return 专业
|
|
*/
|
|
public String getMajor() {
|
|
return major;
|
|
}
|
|
|
|
/**
|
|
* 设置专业
|
|
* @param major 专业
|
|
*/
|
|
public void setMajor(String major) {
|
|
this.major = major;
|
|
}
|
|
}
|