A Java thread moves through six distinct lifecycle states
NEW: The
Threadobject has been instantiated (new Thread()), butstart()has not been called yet. Callingstart()moves it toRUNNABLERUNNABLE: The thread is either actively executing on the CPU or ready in the queue waiting for the OS thread scheduler to assign CPU time.
BLOCKED: The thread is paused because it is trying to enter a
synchronizedblock or method, and another thread currently holds that monitor lock. Returns toRUNNABLEonce the other thread releases the lock and this thread acquires itWAITING: The thread is paused indefinitely, waiting for another thread to perform a specific action or send a signal. Returns to
RUNNABLEwhen notified
TIMED_WAITING: The thread is paused for a specific duration. Returns to
RUNNABLEonce the timer expires or it receives an early notification/interrupt.TERMINATED: The thread has finished executing its
run()method or crashed due to an uncaught exception. None. A terminated thread is dead and cannot be restarted.