1. Wait ()/notify() are native final methods of Object and cannot be overridden.
  2. Wait ()/notify() must obtain the lock first. They are executed in synchronized blocks of code.
  3. Wait (), the current thread releases the lock and is blocked; When notify(), the lock is not released immediately, but rather wakes up a thread that is blocking the current lock and continues execution until the lock is released either by exiting the synchronized block or by calling wait().

NotifyAll wakes up all threads, and the operating system determines which thread executes.

  1. A wait() is surrounded by a try catch.
  2. When multiple threads are waiting for a condition to change, use while (condition not met) {wait ()} to cause the thread to continue blocking if it is awakened unexpectedly, while other awakened threads continue executing.