import java.util.ArrayList; java
import java.util.Iterator; ui
import java.util.List; get
public class ArrayListDemo { it
public static void main(String args[]){ class
List<String> list = new ArrayList<String>(); test
list.add("luojiahui"); import
list.add("luojiafeng"); List
//方法1 方法
Iterator it1 = list.iterator(); im
while(it1.hasNext()){
System.out.println(it1.next());
}
//方法2 怪異!
for(Iterator it2 = list.iterator();it2.hasNext();){
System.out.println(it2.next());
}
//方法3
for(String tmp:list){
System.out.println(tmp);
}
//方法4
for(int i = 0;i < list.size(); i ++){
System.out.println(list.get(i));
}
}
}