In the Java language, a thread is a special object that must be created by the thread class or its child (grandchild) class.
There are usually two ways to create a thread:
One is to use a constructor of type thread (Runnable) to wrap an object that implements the Runnable interface into a thread.
Second, derive the subclass from the thread class and override the Run method, and the object created with that subclass is a thread. It is important to note that the thread class has implemented the Runnable interface, so any thread has its run method, and the Run method contains the code that the thread wants to run.
The activity of a thread is controlled by a set of methods. The Java language supports simultaneous execution of multiple threads and provides a synchronization mechanism between multithreading (the keyword is synchronized).
The Java language is multi-threaded