class A {
public void method() throws IOException {}
}
class b extends A {
public void method() throws IOException, ArithmeticException { }
}
不明白为什么ArithmeticException写进去不报错,ArithmeticException明明不属于IOException。
老师说过方法重写不能抛出超父类范围或者父类未声明的异常,为什么ArithmeticException可以抛出?
谢谢大家
public void method() throws IOException {}
}
class b extends A {
public void method() throws IOException, ArithmeticException { }
}
不明白为什么ArithmeticException写进去不报错,ArithmeticException明明不属于IOException。
老师说过方法重写不能抛出超父类范围或者父类未声明的异常,为什么ArithmeticException可以抛出?
谢谢大家
