java线程--打印错误堆栈信息

2018-01-26 10:45:21来源:oschina作者:鱼君love人点击

分享
public class Test {
static class MyTask implements Runnable {
int a,b;
public MyTask(int a,int b){
this.a=a;
this.b=b;
}
@Override
public void run() {
System.out.println(a/b);
}
}
public static void main(String[] args) {

ExecutorService exs = Executors.newFixedThreadPool(5);

for(int i=0;i<5;i++){
MyTask t = new MyTask(10,i);
exs.execute(t);
}
exs.shutdown();
}
}

微信扫一扫

第七城市微信公众平台