Imagine I have 3 threads with a wait condition, and a 4th thread with a notify condition.
Now, all 3 wait threads run and enter a waiting state. Once this is done, the 4th thread runs and calls notify once.
How will the notify determine which thread to wake up? Is it the thread that called wait first thread, the thread that called wait last, or is it based on some other condition?
Assume that wait and notify uses same lock.