1 changed files with 0 additions and 24 deletions
@ -1,24 +0,0 @@ |
|||
package w3; |
|||
|
|||
public class TestEmployee { |
|||
public static void main(String[] args) { |
|||
// 1. 设置公司名称(静态变量)
|
|||
Employee.companyName = "湖南科技有限公司"; |
|||
|
|||
// 2. 创建两个员工对象
|
|||
Employee emp1 = new Employee("E001", "张三", "技术部", 2500); |
|||
Employee emp2 = new Employee("E002", "李四", "人事部", 1800); |
|||
|
|||
// 3. 打印信息
|
|||
System.out.println(emp1); |
|||
System.out.println(emp2); |
|||
|
|||
// 4. 涨薪
|
|||
emp1.raiseSalary(5); |
|||
emp2.raiseSalary(10); |
|||
System.out.println("\n=====涨薪后====="); |
|||
System.out.println(emp1); |
|||
System.out.println(emp2); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue