Why does the following code throw java.util.ConcurrentModificationException ??
Could someone please explain ConcurrentModificationException in general and in reference to this code! Thanks.
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String args[]){
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
for(String s : list){
if(s.equals("a"));
list.remove("a");
}
System.out.println(list);
}
}