📄 employee.java
字号:
public class Employee{ // Declare two instance variables. One to hold the employee's name // and the other to hold the employee's age private String name; private int age; // Provide a constructor which takes the name and age as parameters public Employee(String aName, int anAge) { name = aName; age = anAge; } // Provide get and set methods for both name and age. // Note: The method names should take the form setName, getName, setAge, and getAge public void setName(String aName) { name = aName; } public void setAge(int anAge) { age = anAge; } public String getName() { return name; } public int getAge() { return age; } // Provide an incAge method which increments the age of the employee when called public int incAge() { age += 1; return age; } // Provide a decAge method which decrements the age of the employee when called. public int decAge() { age += 1; return age; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -