求高手给看看那错了 怎么改
我写的代码但是编译时出错了 请高手给看看代码如下:import java.util.*;
public class EmployeeSortTest {
public static void main(String[] args) {
Employee [] staff=new Employee[3];
staff[0]=new Employee("Harry Hacker",35000);
staff[1]=new Employee("Carl Cracker",75000);
staff[2]=new Employee("Tony Tester",35000);
Arrays.sort(staff);
for(Employee e :staff){
System.out.println("name="+e.getName()+",salary="+e.getSalary());
}
}
}
class Employee implements Comparable<Employee>{
public Employee(String n, double s){
name=n;
salary=s;
}
public String getName(){
return name;
}
public double getSalary(){
return salary;
}
public void raiseSalary(double byPercent){
double raise=salary*byPercent/100;
salary+=raise;
}
public int compareTo(Employee other) {
if(salary<other.salary)return -1;
if(salary>other.salary)return 1;
return 0;
}
private String name;
private double salary;
}
编译运行时提示:
Exception in thread "main" java.lang.NoSuchMethodError: Employee.<init>(Ljava/lang/String;D)V
at EmployeeSortTest.main(EmployeeSortTest.java:5)
求高手给帮忙看看!