📄 employee.java
字号:
public class Employee {
private int id;
private String name;
private double salary;
public Employee(int initialId, String initialName, double initialSalary) {
this.id = initialId;
this.name = initialName;
this.salary = initialSalary;
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public double getSalary() {
return this.salary;
}
public void setSalary(double newSalary) {
this.salary = newSalary;
}
public boolean equals(Object object) {
if (object instanceof Employee) {
Employee employee = (Employee) object;
return employee.getId() == getId()
&& employee.getName().equals(getName())
&& employee.getSalary() == getSalary();
} else {
return false;
}
}
public String toString() {
return getId() + "_" + getName() + "_" + getSalary();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -