发布网友 发布时间:2022-05-11 01:13
共1个回答
热心网友 时间:2023-11-23 02:47
public class People {public class Student extends People{
private Integer id;
public String getMessage(Integer id) {
return "Student: 姓名:"+super.getName()+",年龄:"+super.getAge()+",电话:"+super.getPhone()+",学号:"+id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
public class S {
public static void main(String[] args) {
Student student = new Student();
student.setId(13);
student.setName("李三");
student.setAge(18);
student.setPhone("123-4567-8901");
System.out.println(student.getMessage(student.getId()));
}
}