public static void main(String[] args) throws ExecutionException, InterruptedException { Thread thread = new Thread(() -> { System.out.println("111"); // System.out.println(Thread.currentThread().getName() + "1"); }); Thread thread2 = new Thread(() -> { for (int i = 0; i < 100000; i++) {
}
System.out.println("222");
// System.out.println(Thread.currentThread().getName() + "2"); }); Thread thread3 = new Thread(() -> { System.out.println("333"); // System.out.println(Thread.currentThread().getName() + "3"); }); // thread.start(); // thread2.start(); // thread3.start(); CompletableFuture.runAsync(thread::start) .thenRun(thread2::start) .thenRun(thread3::start); }