import Java.util.ArrayList;import java.util.Iterator;import java.util.List;public class ArrayTest{ public static void main(String[] args) { Listlstint = new ArrayList (); lstint.add(1); lstint.add(2); lstint.add(3); // Iterator遍历一 Iterator iterator = lstint.iterator(); while (iterator.hasNext()) { int i = (Integer) iterator.next(); System.out.println(i); } // Iterator遍历二 for (Iterator it = lstint.iterator(); it.hasNext();) { int i = (Integer) it.next(); System.out.println(i); } // for循环 for (int i = 0; i < lstint.size(); i++) { System.out.println(lstint.get(i)); } // for循环加强版 for (Integer i : lstint) { System.out.println(i); } }}