通过嵌套多个线程,我设法绕过了 try catch 块。
当异常绕过try catch块时,是否有一些规则记录在案?
try{
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("Thread");
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
System.out.println("ThreadGUI");
throw new NullPointerException();
}
});
}
};
Thread t = new Thread(r);
t.start();
} catch(NullPointerException e) {
//nothing
}
System.out.println("Ende");