If multiple threads wait, it should be based on the thread priority. Those with the same priority are random. I can’t remember clearly, so I’ll check the internet again and change my answer.
Object.wait() Needs notify() or notifyAll() to wake up the thread. The former randomly wakes up a thread and then acquires the lock. There is no competition for the lock. The latter compete randomly by priority. Condition to be added.
If multiple threads wait, it should be based on the thread priority. Those with the same priority are random. I can’t remember clearly, so I’ll check the internet again and change my answer.
Object.wait()
Needs notify() or notifyAll() to wake up the thread. The former randomly wakes up a thread and then acquires the lock. There is no competition for the lock. The latter compete randomly by priority.
Condition to be added.