collection coll=new ArrayList
coll.add(“1”)
coll.add(“2”)
coll.add(“3”)
coll.add(“4”)
Iterator it=coll.iterator();
where(it.hasNext()){
system.print.out(it.next());
}
本文展示了如何使用Java中的ArrayList进行元素添加,并通过Iterator实现迭代和打印。重点在于理解迭代器的使用和遍历过程。
collection coll=new ArrayList
coll.add(“1”)
coll.add(“2”)
coll.add(“3”)
coll.add(“4”)
Iterator it=coll.iterator();
where(it.hasNext()){
system.print.out(it.next());
}
6501

被折叠的 条评论
为什么被折叠?