Why i am getting this exception?
I am new to java and stackoverflow
ArrayList<A> a = new ArrayList<A>();
ArrayList<B> b = new ArrayList<B>();
a.add(new A("A"));
a.add(new A("B"));
a.add(new A("C"));
b.add(new B(new A("A"), "a"));
b.add(new B(new A("B"), "b"));
b.add(new B(new A("C"), "c"));
System.out.println(a);
System.out.println(b);
bIterator = b.iterator();
while(bIterator.hasNext()) {
b.add(new B(bIterator.next(), "a"));
}
error
Exception in thread "main" java.util.ConcurrentModificationException