File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Author

Exception handling during inheritance

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
Hi,
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.

Regards,
Anu


With Regards,
Anu
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
Sheriff

Joined: Oct 13, 2005
Posts: 38793
    
  23
There are at least two more compiling errors in that code. Is that exactly what they provided?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception handling during inheritance