package Lyipion;
public class Lyipion {
private int id;
private String name;
private double salary;
public Lyipion(int id, String name, double salary) {
super();
this.id = id;
this.name = name;
this.salary = salary;
}
public Lyipion() {
super();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
package Lyipion;
import java.util.ArrayList;
import java.util.List;
public class Lyipion {
public static void main(String[] args) {
List<Employee> list = new ArrayList<>();
Employee e1 = new Employee(1, "张三", 5000.0);
Employee e2 = new Employee(2, "李四", 5500.0);
Employee e3 = new Employee(3, "赵六", 4000.0);
list.add(e1);
list.add(e2);
list.add(e3);
System.out.println("员工姓名 员工薪资");
for (Employee e : list) {
System.out.println(e.getName() + " " + e.getSalary());
}
}
}