我没有看到我做错了什么,但 NetBeans 给了我以下错误:
incomparable types
required: boolean
found: java.lang.Object
public int compareTo(Object obj) {
if( obj instaceof Employee){
Employee employee = (Employee) obj;
if(this.weekly_earnings > employee.weekly_earnings)
return 1;
else if(this.weekly_earnings == employee.weekly_earnings)
return 0;
else
return -1;
}
else{
System.out.println("Error");
}
}