About Question com.enthuware.ets.scjp.v6.2.607 :
Posted: Mon Oct 13, 2014 7:48 am
I'm at a loss why the compiler error in case 4:
class TestClass2 implements I2,I1{
public void m1() throws SQLException,IOException {}
}
reads "overridden method does not throw SQLException". It does. I can declare a method to throw any number of exceptions, can't I? Each of these exceptions on their own (implementing only one of the interfaces) compile fine. Together it is always the SQLExceptions that the compiler prints as wrong.
class TestClass2 implements I2,I1{
public void m1() throws SQLException,IOException {}
}
reads "overridden method does not throw SQLException". It does. I can declare a method to throw any number of exceptions, can't I? Each of these exceptions on their own (implementing only one of the interfaces) compile fine. Together it is always the SQLExceptions that the compiler prints as wrong.