Why CompletableFuture.runAsync is not executed?
问题 I consider that main thread must end after sub thread.But below code shows the process finished before print the "async end".What is the reason?Can anybody explain?Thx. import java.util.concurrent.CompletableFuture; public class Test { public static void main(String[] args) { CompletableFuture.runAsync(() -> { try { System.out.println("async start"); Thread.sleep(3000); System.out.println("async end"); } catch (InterruptedException e) { e.printStackTrace(); } }); System.out.println("main end"