Java 无法访问的捕获块编译器错误
为什么在Java中,即使一个没有被抛出,我们也能抓住它,但我们不能抓住它的子类(除了“unchecked”和它的子类)。示例代码:ExceptionRuntimeException
class Test {
    public static void main(String[] args) {
        try {
            // do nothing
        } catch (Exception e) {
            // OK           
        }
        try {
            // do nothing
        } catch (IOException e) {
               // COMPILER ERROR: Unreachable catch block for IOException.
               //This exception is never thrown from the try statement body
        }       
    }
}
有什么想法吗?
 
					 
				 
				    		 
				    		 
				    		 
				    		