O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Thread life cycle and states

Understanding the thread life cycle and states is very important when working with threads and multithreaded environments. In the previous examples, we saw how we can create the Java thread object using the Thread class and the Runnable interface. But to start the thread, we have to first create the thread object and call its start() method to execute the run() method as a thread.

The following are different states of the thread life cycle in Java:

  • New: The thread is in the new state when it is created with a new operator. At this stage, the thread is not alive.
  • Runnable: The thread is in the runnable state when we call the start() method of the thread object. At this stage, the thread scheduler still does ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required