aspose file tools*
The moose likes Java in General and the fly likes Inheritance and exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Inheritance and exception" Watch "Inheritance and exception" New topic
Author

Inheritance and exception

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
I have a declaration of a method in interface that throws a particular exception. I implement that interface and give the definition of the method � here I don�t throw any exception.

I am able to compile and run the code.

How can it possible?

Can anybody provide me with link that talks about rules of exception in inheritance?





My blood is tested +ve for Java.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
This Link:
You can also relax the specification by throwing a subset of those exceptions listed in the method's superclass or not throwing any exceptions at all in the overriding method of the subclass. You can not add new exception types to the overriding method.
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Originally posted by wise owen:
This Link:You can not add new exception types to the overriding method.


You can not add new checked exception types to the overriding method.


Tony Morris
Java Q&A (FAQ, Trivia)
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Thx! both of you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance and exception