如何创建POJO?
最近,我开始听说“POJO”(普通的旧Java对象)。我用谷歌搜索了它,但仍然不太理解这个概念。任何人都可以给我一个清晰的描述POJO?
考虑一个带有变量“id,姓名,地址,薪水”的类“Person” - 我如何为这种情况创建POJO?下面的代码是 POJO 吗?
public class Person {
//variables
People people = new People();
private int id;
private String name;
private String address;
private int salary;
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public int getSalary() {
return salary;
}
public void setId() {
this.id = id;
}
public void setName() {
this.name = name;
}
public void setAddress() {
this.address = address;
}
public void setSalary() {
this.salary = salary;
}
}