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 ...