thread state

One of the six states of Thread.State that a thread passes through from creation to completion.

In more detail

A thread is NEW until start() is called, RUNNABLE while it can run, BLOCKED waiting for a monitor, WAITING or TIMED_WAITING in join, wait or sleep, and TERMINATED after run returns. A terminated thread cannot be started again.

Example

Thread t = new Thread(() -> { });
System.out.println(t.getState()); // NEW

Related terms

Taught in

References

Certification courses