编辑代码

package Myself.java;
import java.util.ArrayList;

public class Employee {
	private int id;
	private String name;
	private double salary;
	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;
	}
	
	public Employee() {
		super();
	}
	
	public Employee(int id, String name, double salary) {
		super();
		this.id = id;
		this.name = name;
		this.salary = salary;
	}
	public static void main(String[] args) {
		ArrayList<Employee> list = new ArrayList<Employee>();
		Employee e1 = new Employee(1, "张三", 5000.0);
		Employee e2 = new Employee(1, "李四", 5500.0);
		Employee e3 = new Employee(1, "赵六", 4000.0);
		list.add(e1);
		list.add(e2);
		list.add(e3);
		System.out.println("员工姓名    员工薪资");
		for(int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i).getName() + "           " + list.get(i).getSalary());
		}
	}
}