java.lang · java.base · since Java 1.0
Thread
public class Thread implements RunnableA thread of execution. Modern creation goes through Thread.ofPlatform()/ofVirtual() builders or executors; interruption is the cooperative cancellation protocol.
Key methods
void start() | Begins execution on a new thread (run() would execute on YOUR thread). |
void interrupt() / boolean isInterrupted() | Request and check cooperative cancellation. |
void join() / join(millis) | Wait for termination. |
static void sleep(long millis) | Park (holding any locks!); throws InterruptedException. |
static Thread currentThread() | The executing thread. |
static Builder.OfVirtual ofVirtual() / OfPlatform ofPlatform() | Java 21 builders — name, daemon status, start. |
Thread.State getState() | NEW/RUNNABLE/BLOCKED/WAITING/TIMED_WAITING/TERMINATED. |
void setUncaughtExceptionHandler(…) | Last-chance logging for dying threads. |