这段java代码是什么意思?求大神解释一下!!!
publicintcompareTo(Objecta){if(ainstanceofEmployee){Employeees=(Employee)a;if(this.sa...
public int compareTo(Object a) {
if (a instanceof Employee) {
Employee es = (Employee) a;
if(this.salary>es.salary) {
return 1;
} else if(this.salary==es.salary) {
return 0;
} else {
return -1;
}
}
return -1;
} 展开
if (a instanceof Employee) {
Employee es = (Employee) a;
if(this.salary>es.salary) {
return 1;
} else if(this.salary==es.salary) {
return 0;
} else {
return -1;
}
}
return -1;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询