List集合遍历

public class practse14 {
public static void main(String[] args) {
List list=new ArrayList();
list.add("xiaoming");
list.add("longge");
list.add("daming");
ListIterator it=list.listIterator();
while(it.hasNext()){
System.out.println(it.next());
}
for(int i=0;i System.out.println(list.get(i));
}
}
}

你可能感兴趣的:(迭代器遍历,for循环遍历)