以下处理方式有什么区别InterruptedException?最好的方法是什么?
try{
//...
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
}
Run Code Online (Sandbox Code Playgroud)
要么
try{
//...
} catch(InterruptedException e) {
throw new RuntimeException(e);
}
Run Code Online (Sandbox Code Playgroud)
编辑:我也想知道这两个使用的场景.
java multithreading exception-handling interrupted-exception
我是一名C#开发人员,偶尔用Java编写代码.有人可以用简单的术语解释Java中检查的异常是什么以及为什么需要它?没有在C#中遇到过这个术语.