62,614
社区成员
发帖
与我相关
我的任务
分享
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
public class MyCalllable<V> implements Callable<V> {
public static void main(String[] args) {
// TODO Auto-generated method stub
Callable<Object> c1=new MyCalllable<Object>();
FutureTask<Object> t1=new FutureTask<Object>(c1);
Thread t=new Thread(t1);
t.setName("mycallable");
System.out.println(Thread.currentThread().getName());
t.start();
System.out.println(Thread.currentThread().getName());
}
@Override
public V call() throws Exception {
// TODO Auto-generated method stub
System.out.println("hello Callable");
return null;
}
}
main
main
hello Callable