public static void main(String[] args) {
List<String> a = new ArrayList<String>();
a.add("1");
a.add("2");
a.add("23");
for (String temp : a) {
if ("23".equals(temp)) {
a.remove(temp);
}
}
System.out.println(a);
}
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at wan.ForEach.main(ForEach.java:22)
慕的地8271018
智慧大石
RISEBY
慕妹3146593
相关分类