This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Exception handling during inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception handling during inheritance" Watch "Exception handling during inheritance" New topic

Exception handling during inheritance

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
I had been to one interview, there they gave me a code:

is it a valid code? how to manage exceptions when a class is inherited?

According to my knowledge, IO Exception is handled in class A so, there is no need to handle it again the child class...hope i am correct.
Please correct me if i am going wrong some where.


With Regards,
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you cant use throws with class name . in java method only should use throws . use try and catch to handle an Exception.

For Your Information Exception Handling

Hope this helps
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44433
There are at least two more compiling errors in that code. Is that exactly what they provided?
I agree. Here's the link:
subject: Exception handling during inheritance
jQuery in Action, 3rd edition