Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

exception handling impl

I was reading folowing lines and I did not understand clearly.
The overriding method can throw narrower or fewer exceptions. Just because
an overridden method takes risks doesnot mean that the overriding subclass
exception takes the same risks. Bottom line is overriding method doesnot have to declare any exceptions that it will never throw, regardless of what the
overridden method declares.

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is becasue overriding has in fact to do with the way method interacts with the outside world - therefore
signatueres shoudl be the same, and exceptions very much depend on implementation.
Maybe ovrriden method goes to get the result to some file, and
overriding does nit need to do it then obviously it would not need to throw those exception which overriden method needs to throw
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial