我需要帮助来修复我的代码。我不知道问题出在哪里,但是printf
当我运行此代码时,编译器似乎给了我错误。为什么?
Employee emp1 = new Employee();
emp1.setFname("Kim");
emp1.setLname("Yee");
emp1.setID(101);
emp1.setSalary(40000);
Employee emp2 = new Employee();
emp2.setFname("Lana");
emp2.setLname("Yum");
emp2.setID(102);
emp2.setSalary(55.000);
Employee emp3 = new Employee();
emp3.setFname("Alex");
emp3.setLname("Jhone");
emp3.setID(103);
emp3.setSalary(55.500);
Employee emp4 = new Employee();
emp4.setFname("joe");
emp4.setLname("mac");
emp4.setID(104);
emp4.setSalary(74.000);
System.out.println("Employee Name \t Employee ID \t Employee salary");
System.out.printf("%s %s\t%d\t$%f\n", emp1.getFname() + "" + emp1.getLname(), emp1.getID(), emp1.getSalary());
System.out.printf("%s %s\t%d\t$%f\n", emp2.getFname() + "" + emp2.getLname(), emp2.getID(), emp2.getSalary());
System.out.printf("%s %s\t%d\t$%f\n", emp3.getFname() + "" + emp3.getLname(), emp3.getID(), emp3.getSalary());
System.out.printf("%s %s\t%d\t$%f\n", emp4.getFname() + "" + emp4.getLname(), emp4.getID(), emp4.getSalary());