public class Student extends Person {//学生继承Person
public static int count = 0;
private String studentId;
private String mclass;
public Student() {
super();
count++;
}
public Student(String name) {
super(name);
count++;
}
public Student(String name, String sex, int age, String address, String birthDay,String studentId,String mclass) {
super(name, sex, age, address, birthDay);
this.studentId = studentId;
this.mclass = mclass;
count++;
}
public String getStudentId() {
return studentId;
}
public void setStudentId(String studentId) {
this.studentId = studentId;
}
public String getMclass() {
return mclass;
}
public void setMclass(String mclass) {
this.mclass = mclass;
}
@Override
public String toString() {
return name + “是一个” + sex +“生, Ta已经” + age + “了, Ta出生在” + birthDay + “,Ta家住在” + address
- “, Ta学号为:” + studentId + “, Ta的专业是:” + mclass ;
}
public void work() {
System.out.println(name + “在学习”);
}
}