jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface and exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface and exceptions" Watch "Interface and exceptions" New topic

Interface and exceptions

Hans Beck�rus

Joined: Aug 23, 2006
Posts: 24
I read the following
A legal nonabstract implementing class has the following properties:
- It must not declare any new checked exceptions for an implementation method.
- It must not declare any checked exceptions that are broader than the exceptions declared in the interface method.

I have some problem understanding how you could fulfil the first but fail to fulfil the second?

Anyone that could explain (maybe with a simple code example) how these rules correlate?
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

Check comments in above code.
Make changes according comments and see the result.
Try to understand compiler error messages.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023

[ August 30, 2006: Message edited by: wise owen ]
Hans Beck�rus

Joined: Aug 23, 2006
Posts: 24
Thanks guys. That did the trick.
Now it is all crystal clear!
joy peter

Joined: Aug 29, 2006
Posts: 13
Non abstract implementation class can throw broader exceptions but not new surprise exceptions that are not in super class.

Awake Arise and Stop Not Till Your goal is reached
I agree. Here's the link: http://aspose.com/file-tools
subject: Interface and exceptions
It's not a secret anymore!