Java定义一个Student类,包括学号、姓名、性别、班级、出生日期 10
定义一个Student类,包括学号、姓名、性别、班级、出生日期,还应该有想要的构造方法,显示学生学习的方法,计算学生年龄的方法,修改学生姓名的方法。编写一个测试程序测试是...
定义一个Student类,包括学号、姓名、性别、班级、出生日期,还应该有想要的构造方法,显示学生学习的方法,计算学生年龄的方法,修改学生姓名的方法。编写一个测试程序测试是否实现了预定的功能。
展开
1个回答
2019-09-26
展开全部
public class Student {
private String sno; //学号
private String name; //姓名
private String sex; //性别
private String calss; //班级
private String major; //专业
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getCalss() {
return calss;
}
public void setCalss(String calss) {
this.calss = calss;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public Student() {
}
public Student(String sno, String name) {
this.sno = sno;
this.name = name;
}
public Student(String sno, String name, String sex, String calss,
String major) {
this.sno = sno;
this.name = name;
this.sex = sex;
this.calss = calss;
this.major = major;
}
private String sno; //学号
private String name; //姓名
private String sex; //性别
private String calss; //班级
private String major; //专业
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getCalss() {
return calss;
}
public void setCalss(String calss) {
this.calss = calss;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public Student() {
}
public Student(String sno, String name) {
this.sno = sno;
this.name = name;
}
public Student(String sno, String name, String sex, String calss,
String major) {
this.sno = sno;
this.name = name;
this.sex = sex;
this.calss = calss;
this.major = major;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询