package com.itheima;
import java.util.*;
public class Demo {
public static void main(String[] args)
{
ArrayList al=new ArrayList();
al.add("java01");
al.add("java02");
al.add("java03");
al.add("java04");
Iterator it=al.iterator();
while(it.hasNext())
{
Object obj=it.next();
if(obj.equals("java02"))
it.remove();
System.out.println("al="+obj);//为何这里的java02还能被打印?????????????
}
System.out.println(al);到这里被删掉了?????
|
|