立即学习:https://edu.csdn.net/course/play/26270/326858?utm_source=blogtoedu
ExecutorService executorService = Executor.newFixedThreadPool(1);
Future<String> submit = executorService.submit(new Callable<String>(){
@Override
public String call(){
System.out.print("正在执行...");
return "success";
}
});
System.out.println("正在做主线程的事情...");
// 业务代码xxxxx
// 获取异步结果
String result = submit.get();
System.out.println("拿到结果:" + result);