package test;
public class Employee{
private int number;
private String name;
private String post;
private double salary;
public Employee() {
super();
// TODO Auto-generated constructor stub
}
public Employee(int number, String name, String post, double salary) {
super();
this.number = number;
this.name = name;
this.post = post;
this.salary = salary;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
List<Employee> list = new ArrayList<Employee>();
list.add(new Employee(1, "张三1", "保安", 600));
list.add(new Employee(1, "张三2", "保安", 600));
list.add(new Employee(1, "张三3", "保安", 600));
list.add(new Employee(1, "张三4", "保安", 600));
list.add(new Employee(1, "张三5", "保安", 600));
for (Employee e : list) {
System.out.println(e.getName());
}
|