标签:实现 return art bug except override exception 接口 ret
1.创建Thread对象 并实现run方法
Thread thread=new Thread(){
@Override
public void run() {
super.run();
log.debug("running");
}
};
thread.start();
2.实现Runnable接口并把该对象作为参数传给Thread对象
Runnable runnable=new Runnable() {
@Override
public void run() {
System.out.println(120);
}
};
Thread thread=new Thread(runnable);
3.
FutureTask<Integer> futureTask=new FutureTask<>(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
Thread.sleep(5000);
System.out.println(1111111);
return 100;
}
});
Thread thread=new Thread(futureTask);
thread.start();
System.out.println(futureTask.get());
标签:实现 return art bug except override exception 接口 ret
原文地址:https://www.cnblogs.com/mc-74120/p/12810617.html