Given Following Code, why is it not allowed for MyMethod() to declare IOException in MyExp2 class( question 9 from http://www.javacaps.com/scjp_mockexams1.html )??? Overriding a method that doesnt throw Exception wont have overriden method which does throw Exception? Do Overriden methods have some scope rule for throwing exceptions as in they can only throw exceptions that are already thrown in the overridden method of subclass??
Nils, for the first part of ur query, i think this is the solution: As class MyExp2 extends class MyExp1, and also overrides the MyMethod() method of MyExp1( which is its immediate superclass). As the MyMethod() of superclass(MyExp) doesn't throw any Exception so the overriding method in its subclass can't throw any other(Except RunTimeException) exception. In short MyMethod() of MyExp2 should be defined in the context of its immediate superclass i.e. MyExp1. hope it should be o.kay. ashok.