java创建一个学生类,其成员变量姓名,学号,专业

正在考试,在线急等
2024-11-27 12:04:34
推荐回答(1个)
回答1:



public class Student {


private String name;

private String xuehao;

private String zhuanye;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getXuehao() {

return xuehao;

}

public void setXuehao(String xuehao) {

this.xuehao = xuehao;

}

public String getZhuanye() {

return zhuanye;

}

public void setZhuanye(String zhuanye) {

this.zhuanye = zhuanye;

}

}