aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes basic interface doubt 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 "basic interface doubt" Watch "basic interface doubt" New topic
Author

basic interface doubt

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
K&B:
"in order to be a legal implementation class,
a nonabstrat implementation class must do the following:
.
.
.
-Declare no checked exceptions on implementation methods other than those declared by the interface method, or subclasses of those declared by the interface method.

i am soooo confused by this term.
is it refering a scenario like this..???
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
No, your code is perfectly legal if you remove the obvious error:


Both classes declare one of the Czech Exceptions and leave the other one out.

What you cannot do is to declare new, other Exceptions that aren't declared in the interface:




Yours,
Bu.
[ November 06, 2007: Message edited by: Burkhard Hassel ]

all events occur in real time
Nabila Mohammad
Ranch Hand

Joined: Nov 05, 2007
Posts: 661
You can declare all,none or subset of the exceptions declared in the Interface.
No new ones.


The future belongs to those who believe in the beauty of their dreams.Dream BIG!
Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Originally posted by Nabila Mohammad:
You can declare all,none or subset of the exceptions declared in the Interface.
No new ones.

...except unchecked exceptions (i.e. subclasses of RuntimeException) and errors. You can declare any of those regardless of whether the original interface declares it.


SCJP 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: basic interface doubt