日期:2014-05-20  浏览次数:20779 次

谁能讲解下。。。。。。。。。

public   int   compareTo(Object   otherObject)
{
Employee   other   =   (Employee)   otherObject;  
if   (salary   <   other.salary)
return   -1;
if   (salary   >   other.salary)
return     1;
return   0;
}

------解决方案--------------------
讲解什么?

实现了Comparable接口的一个方法,

用来判断两个员工的工资多少。
------解决方案--------------------
salary是比较标准
莫非是冒泡?
------解决方案--------------------
这个实现了java.util.Comparator的接口
就可以用运用
public static void sort(List list)方法
就可以排序了