Skip to content

Q 25 - Thread LifeCycle #29

Discussion options

You must be logged in to vote

Here’s a clean and complete explanation of the Java Thread Life Cycle, based on your GitHub discussion titled “Q 25 - Thread LifeCycle” and enriched with practical insights:


🔄 Java Thread Life Cycle

A thread in Java goes through several distinct states during its execution. These are defined in the java.lang.Thread.State enum.

🧵 1. New

  • Description: Thread is created but not yet started.
  • Code: Thread t = new Thread();

▶️ 2. Runnable

  • Description: Thread is ready to run and waiting for CPU time.
  • Code: t.start();
  • Note: It doesn’t mean it’s running — just eligible to run.

🏃 3. Running

  • Description: Thread is actively executing.
  • Managed by: JVM thread scheduler.
  • Note: You can’t force a …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AmjustGettingStarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants