1.

If two threads access the same hashmap at the same time, what would happen?(a) ConcurrentModificationException(b) NullPointerException(c) ClassNotFoundException(d) RuntimeExceptionI had been asked this question in an online interview.Asked question is from Data Structures-HashMap topic in portion java.util – The Collections Framework of Java

Answer»

Right OPTION is (a) ConcurrentModificationException

The best I can explain: The code will THROW ConcurrentModificationException if two THREADS ACCESS the same hashmap at the same TIME.



Discussion

No Comment Found

Related InterviewSolutions