1.

What happens if two threads simultaneously modify TreeSet?(a) ConcurrentModificationException is thrown(b) Both threads can perform action successfully(c) FailFastException is thrown(d) IteratorModificationException is thrown

Answer» Correct choice is (a) ConcurrentModificationException is thrown

Best explanation: TreeSet provides fail-fast iterator. Hence when concurrently modifying TreeSet it throws ConcurrentModificationException.


Discussion

No Comment Found

Related InterviewSolutions