Hi Ranchers,
Find below the question
A. The notifyAll() method must be called from a synchronized context.
B. To call wait(), an object must own the lock on the
thread.
C. The notify() method is defined in class java.lang.Thread.
D. When a thread is waiting as a result of wait(), it release its lock.
E. The notify() method causes a thread to immediately release its lock.
F. The difference between notify() and notifyAll() is that notifyAll() notifies all waiting threads, regardless of the object they're waiting on.
and the answers for the above are
A and
D. I understand the first answer is correct. but how the option D is correct.
According to my knowledge Thread can oly release its locks by exiting the synchronized code.
I am confused. Let me know what is correct.