Life cycle of a Thread in java

Life cycle of a Thread

A thread goes through different stages in its life cycle. A thread can be in five states. The life cycle of the thread in java is controlled by JVM. The java thread states are as follows:



When you created an instance of Thread class, then it is in new state.


After a new state, the thread bexomes runnable state. A thread in this state is considered to be executing its task.


The thread is in running state if the thread scheduler has selected it.


Sometimes, a thread transitions to the waiting state while the thread waits for another thread to perform a task.


When run() method exist then runnable thread enters dead state

Leave a Reply

Your email address will not be published. Required fields are marked *