Online GK Series

This site is dedicated to the aspirants of competitive exams SSC, UPSC, Railways, Postal Assistants, Bank, GATE and NET


What will be the result of invoking the wait() method on an object without ensuring that the current thread holds the lock of the object?

A The code will fail to compile
B Nothing special will happen
C An IllegalMonitorStateException will be thrown if the wait() method is called, while the current thread does not hold the lock of the object
D The thread will be blocked until it gains the lock of the object
Answer & Explanation
Option: [C]

Your Valuable Comments Please...

Useful Computer Science EBooks