Can you explain the Java thread lifecycle?

Answer Posted / nashiinformaticssolutions

In Java, a thread can exist in any of the following states. The states are as follows:

New: When a new thread is first created, it is always in the new state. For a thread in the new state, the function hasn't begun to execute because it hasn't been performed yet.

Active: When a thread invokes the start() method, it moves from the new state to the active state. The active state contains both the running state and the runnable state.

Blocked or Waiting: When a thread is not active for a period of time (but not forever), it is either in the blocked state or the waiting state.

Timed waiting is what happens when we apply the sleep() technique to a certain thread.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of set in java?

690


What is meant by object?

771


Explain creating threads by extending thread class ?

757


Do you need to import math in java?

749


What is nullpointerexception?

749


what is a thread pool in java and why is it used?

703


Can java program run without jre?

760


List the interfaces which extends collection interface?

728


define polymorphism in java

833


Is java an ide?

716


Can we use string in switch case in java?

784


What are pass by reference and pass by value?

695


What is the purpose of the runtime class in java programming?

769


Why does java have two ways to create child threads? Which way is better?

772


Which collection is sorted in java?

777