编写一个JavaBean,信息包括:员工编号、姓名 、性别、部门、职务。该bean能够设置和获取员工的所有信息,急
1个回答
展开全部
呃,这个还要人帮忙?兄弟,就是写属性,然后get set方法。
比如,有个name属性
private String name;
然后写get方法和set方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
测试类如下
public class Test {
private String No;
private String name;
private String sex;
private String department;
private String post;
public String getNo() {
return No;
}
public void setNo(String no) {
No = no;
}
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 getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
}
比如,有个name属性
private String name;
然后写get方法和set方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
测试类如下
public class Test {
private String No;
private String name;
private String sex;
private String department;
private String post;
public String getNo() {
return No;
}
public void setNo(String no) {
No = no;
}
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 getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询