There are two approaches to this:
1, sequential method of execution by join assurance thread
join the main thread is waiting for the child after the end of the thread to continue execution.
The source code is called join () -> wait () method, so that the main thread waits for the child thread.
2, the thread pool by: newSingleThreadExecutor ();
The main use is
static ExecutorService executorService =Executors.newSingleThreadExecutor()
public static void main(***){
executorService.submit(Thread1)
executorService.submit(Thread2)
executorService.submit(Thread3)
}