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

How are multiple inheritances done in Java?

707


How list contains works in java?

633


Why is stringbuffer thread safe?

666


What is anagram in java?

617


how can you take care of mutual exclusion using java threads? : Java thread

692






What is are packages?

677


What is the use of java?

621


What is rule of accessibility in java?

639


How to display arraylist values in java?

574


What is the purpose of the strictfp keyword?

694


What is difference between identifier and variable?

574


What is floor math?

593


What is tcp and udp?

686


What does next mean in java?

629


Can we override constructor?

629