我要把自定义类进行大小比较 这个类要实现哪个接口 哪个方法?
那个得重载运算符了,JAVA里好像没这么用的,只对一些基本类型的包装类可以
Interface Comparable
只有一个方法compareTo()
排序不就是比较完大小才能排么 :?
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.