Answer the question
In order to leave comments, you need to log in
wait, notify, notifyAll methods in Object (Java): why do you think methods are defined in this particular class?
wait, notify, notifyAll are more suitable for threads - i.e., for example, the Thread class.
Answer the question
In order to leave comments, you need to log in
In order not to write extra code in simple cases. No one forbids using the Lock and Condition interfaces (which have analogues - await, signal, signalAll), which allow more flexible use of synchronization, for example, to implement several different locks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question