A thread which has invoked wait() method of an object, still owns the lock of the object. Is this statement true or false?

Options
- True
- False


CORRECT ANSWER : False

Discussion Board
Threads

The java.lang.Object.wait() causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. In simple terms during wait() it doesn't own the lock of the object. But whereas it still owns the object's monitor and keep monitoring till its execution is over. It hands over the ownership of the monitor and wait for another thread to notify using a notify method or notifyAll method. This way a method can be called by only the thread that has the ownership of the object's monitor.

Rohit Sharma 07-27-2014 11:32 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement