Interviews - C# Corner

Rohit Gupta
What is a Thread-Lifecycle in Java?
By Rohit Gupta in Java onSep 10 2019
  • Vijay Kumari
    Sep, 2019 16

    1) New

    A new state is the first state of the thread. The thread is in new state if we create an object of the Thread class but before the invocation of start() method.

    2) Runnable

    After a new thread starts, the thread is in the second state after the invocation of start() method, but the scheduler has not selected it to be in the running thread.

    3) Running

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

    4) Non-Runnable (Blocked)

    The fourth state is non-runnable(blocked). This is the state when the thread is alive but is currently not eligible to run.

    5) Terminated

    The last state of a thread is terminated. A thread is in the terminated state when its run() method exits.

    For a detailed tutorial on Java MultiThreading, visit
    https://www.c-sharpcorner.com/article/a-complete-multithreading-tutorial-in-java/

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS