首先,我们先看看使用Callable创建线程与使用Runable的区别:
区别
import java.util.concurrent.Callable;
//实现Runable
class MyThread implements Runnable {
@Override
public void run() {
}
}
//实现Callable
class MyThread1 implements Callable<Integer> {
@Override
public Integer call() throws Exception {
return null;