class="java" name="code">package cn.itcast.myeclipse; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Demo2 { public static void main(String[] args) { List list = new ArrayList(); list.add(1); list.add(2); list.add(3); Iterator it = list.iterator(); while (it.hasNext()) { int j = (Integer) it.next(); } }