// 创建集合对象ArrayList array = new ArrayList();//创建元素,并添加元素array.add("hello");array.add("world");//遍历方法1:迭代器:hasNext()+next()Iterator it = array.iterator();while(it.hasNext()){ String s = (String)it.next(); System.out.PRintln(s);}方法2:size()+get()for(int x=0;x<array.size();x++){ String s = array.get(x); System.out.println(s);}