package com.cxy.juc; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; class MyThread implements Callable<Integer> { @Override public Integer call() throws Exception { return 1024; } } public class CallableDemo { public static void main(String[] args) throws ExecutionException, InterruptedException { FutureTask<Integer> futureTask =new FutureTask(new MyThread()); new Thread(futureTask,"a").start(); Integer reslut =futureTask.get(); System.out.println(reslut); } }