讨论/技术交流/求大佬解释/

public class Employee {
public String name;
private double salary;
public Employee (String empName) {
name = empName;
}
public void setSalary(double empSal) {
salary = empSal;
}
public void printEmp() {
System.out.println("名字:"+ name);
System.out.println("薪水:"+ salary);
}
public static void main(String[] args) {
Employee empOne = new Employee("RUNOOB");
empOne.setSalary(1000.0);
empOne.printEmp();
}
}

1
共 0 个回复
暂无回复