Grokking Java Interview Questions
0% completed
Iterators and ConcurrentModificationException
A cleanup job removes sold-out products from a shopping cart. On its first run, the job stops and prints this line:
Exception in thread "main" java.util.ConcurrentModificationException
The name suggests that two threads were involved, yet the program has only one thread. The lines printed below the message, which are called the stack trace, name the for loop over the cart and a method called checkForComodification. That method belongs to the iterator of ArrayList.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%