package com.itbuluoge.mythread;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
class MyThread implements Runnable
{
public void run()
{
throw new RuntimeException();
}
}
public class ExceptionThread{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
ExecutorService exec=Executors.newCachedThreadPool();
exec.execute(new MyThread());
}
catch(Exception e)
{
System.out.println("exception");
}
}
}
runnable的线程抛出异常无法捕获
最新推荐文章于 2024-07-31 15:34:48 发布