2.2.1Callable接⼝例程没有抛出异常
mapleafly opened this issue · comments
leoxxx commented
public static void main(String args[]){
// 使⽤
ExecutorService executor = Executors.newCachedThreadPool();
Task task = new Task();
?uture result = executor.submit(task);
// 注意调⽤get⽅法会阻塞当前线程,直到得到结果。
// 所以实际编码中建议使⽤可以设置超时时间的重载get⽅法。
System.out.println(result.get());
}
其中,result.get()需要try,或者main方法抛出
initial-y commented
感谢反馈 ,已修复