the Exception catch including a class match process , you can write code catch father class and catch sub class on runtime , when throw exceptions , the subclass will cast to declared throws class type, that meas throws class Exception based on the declaration of method(), and because Exception class is the root class of Exception class tree , so you have to declare catch Exception class .
static void method() throws Exception{}
看这句,你声明的异常为Exception,虽然实际抛出的为EOFException。
catch应该捕捉你声明的异常而不是实际的。