문제

I encountered the following method, which to my surprise compiled just fine:

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;
    }

}

Why isn't it necessary for the Exception to be caught?

도움이 되었습니까?

해결책

It is the feature added in Java 7. Have a look at Rethrowing Exceptions with More Inclusive Type Checking

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top