aspose file tools
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
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: 41548
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