我遇到了以下方法,令我惊讶的是它编译得很好:
private String getControlMessageBlocking() throws ProtocolException,
InterruptedException, IOException {
try {
// <Code that may throw any of the three listed exceptions>
return controlMessage;
} catch (Exception e) {
throw e;
}
}
为什么没有必要捕获Exception
?
最佳答案
这是Java 7中添加的特性。看看Rethrowing Exceptions with More Inclusive Type Checking
关于java - 编译期间的意外异常处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21907697/