- 博客(2)
- 收藏
- 关注
原创 使用Comparable接口自定义排序
Comparable接口用于强行对实现它的每个类的对象进行排序。在实现该接口的类中,必须实现compareTo()方法,用于指定排序规则。Comparable的声明:public class A implements Comparable<A>{}在实现compareTo()方法后,若将对象保存到列表中,可通过执行Collections.sort()方法进行自动排序;若保存到数组中,可...
2018-04-14 23:05:50
535
1
原创 Java中常见错误提示
Multiple markers at this line 这一行有多个错误标记List cannot be resolved to a typeList 不能解析为一个类,这种情况是要导入包,或类没有定义Type mismatch: cannot convert from element type A to B类型不匹配:不能把元素类型A转换到B 这是for(A a:array...
2018-04-14 21:57:15
2444
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅