compareTo

From:

https://blog.csdn.net/qq_23179075/article/details/78753136

 

这里说一下重写的 public int compareTo(Student o){} 这个方法,它返回三种 int 类型的值: 负整数,零 ,正整数。
返回值     含义
负整数     当前对象的值 < 比较对象的值 , 位置排在前
零     当前对象的值 = 比较对象的值 , 位置不变
正整数     当前对象的值 > 比较对象的值 , 位置排在后

   
   
   
   
posted @ 2019-07-18 17:00  ck_2016  Views(139)  Comments(0)    收藏  举报