The wait() method is employed to temporarily cede possession of a lock so that another thread can proceed. It must always be used inside a synchronized block. To resume activity, the other thread must notify the waiting thread. Moreover, the wait() method should be invoked in a loop that checks if a condition predicate holds.
...