Multi-threaded programs are written to achieve concurrent execution of multiple tasks, so as to better interact with users. Generally, there are three methods: Thread, Runnable, and Callable. the difference between Runnable and Callable is that (1) Callable specifies the call () method and Runnable specifies the run () method (). (2) Callable tasks can return values after execution, while Runnable tasks cannot return value (3) the call method can throw an exception and the run method cannot (4) run the Callable task to get a Future object, indicating the result of asynchronous calculation. It provides a method to check whether the computation is complete, waiting for the computation to complete and retrieving the computation results. You can use the Future object to understand the task execution status, cancel the task execution, and obtain the execution result. 1. Create a Thread by implementing the Runnable interface: Step 1: Create a class that implements the Runnable interface: class SomeRunnable implements Runnable {public void run () {// do something here} Step 2: Create a Class Object: Runnable oneRunnable = new SomeRunnable (); Step 3: Create a Thread object by Runnable: thread oneThread = new Thread (oneRunnable); Step 4: start Thread: oneThread. start (); so far, a thread has been created. Note: The thread execution process is very simple. When the code oneThread is executed. start ();, it will execute void run () in the oneRunnable object; method. After this method is completed, the thread will die. 2. Similar to method 1, The Callable interface is implemented to create a Thread. The Callable interface (or only one method) is defined as follows: public interface Callable <V> {V call () throws Exception;} Step 1: Create a class SomeCallable that implements the Callable interface <Integer> (omitted); Step 2: Create a class object: callable <Integer> oneCallable = new SomeCallable <Integer> (); Step 3: Create a FutureTask <Integer> object by Callable <Integer>: futureTask <Integer> oneTask = new FutureTask <Integer> (oneCallable); Note: FutureTask <Integer> is a package that accepts Callab Le <Integer>, which implements both the Future and Runnable interfaces. Step 4: Create a Thread object by FutureTask <Integer>: Thread oneThread = new Thread (oneTask); Step 5: start Thread: oneThread. start (); so far, a thread has been created. 3. Create a Thread by inheriting the Thread class: Step 1: Define a subclass that inherits the Thread class: class SomeThead extends Thraad {public void run () {// do something here} Step 2: Construct an object of the subclass: SomeThread oneThread = new SomeThread (); Step 3: start thread: oneThread. start (); so far, a thread has been created.