A thread enters the waiting state when it blocks on I/O.
In Java, when a thread blocks on I/O (Input/Output) operations, it enters the “BLOCKED” state. The “BLOCKED” state indicates that the thread is waiting for a monitor lock to enter or re-enter a synchronized block/method or waiting for some resource to become available.
It’s worth noting that there is also a “WAITING” state, which is different from the “BLOCKED” state. The “WAITING” state is typically associated with explicit thread synchronization mechanisms, where a thread is waiting indefinitely for another thread to perform a particular action. In the context of I/O operations, the “BLOCKED” state is more relevant.
To summarize, when a thread is blocked on I/O, it enters the “BLOCKED” state in Java.