摘要: public class CollectionDemo { public static void main(String[] args) { //创建collection集合对象 Collection<Student> c = new ArrayList<Student>(); //创建学生对象 S 阅读全文
posted @ 2020-04-06 19:28 硬盘红了 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Iterator : 迭代器,集合的专用遍历方式Iterator <E> iterator() : 返回此集合中元素的迭代器,通过集合的iterator()方法得到迭代器是通过集合的iterator()方法得到的,所以我们说它是依赖于集合而存在的Iterator中的常用方法 E next() : 返 阅读全文
posted @ 2020-04-06 17:06 硬盘红了 阅读(130) 评论(0) 推荐(0) 编辑
摘要: boolean add(E e) import java.util.ArrayList; import java.util.Collection; public class CollectionDemo_02 { public static void main(String[] args) { // 阅读全文
posted @ 2020-04-06 15:40 硬盘红了 阅读(176) 评论(0) 推荐(0) 编辑
摘要: /* 自定义异常:ScoreException */ public class ScoreException extends Exception { //无参构造 public ScoreException(){} //带参构造 public ScoreException(String messag 阅读全文
posted @ 2020-04-06 14:23 硬盘红了 阅读(143) 评论(0) 推荐(0) 编辑