public class call {code
public static void main(String[] args) throws InterruptedException, ExecutionException { ExecutorService service = Executors.newFixedThreadPool(1); Race r=new Race();//實現了Callable接口 Future<Integer> result=service.submit( r); int number = result.get(); System.out.println(number); service.shutdownNow(); }
}接口