Java Thread
A thread is a unit of execution flow within a process. A process can have one or more threads and execute them concurrently. This execution method is called multithreading, and Java supports multithreading.
You can think of a process as something that contains multiple threads.
There are two ways to create a thread. One is to directly extend the Thread class, and the other is to implement the Runnable interface.
| Method name | Description |
|---|---|
void run() |
Describes the part executed by the thread. It must be redefined in a subclass. |
How to Use Java CompletableFuture
Learn how to use CompletableFuture for complex thread processing in Java.