aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes about unimplemented exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "about unimplemented exceptions" Watch "about unimplemented exceptions" New topic
Author

about unimplemented exceptions

Mary John
Ranch Hand

Joined: Sep 17, 2007
Posts: 109
My assignment has the followig sentence in it along with the server interface. Can any one please explain what this means?


Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a String that serves as the exception's description.

My interface has RecordNotFoundException, DuplicateKeyException, SecurityException in it.


SCJP 5.0<br />SCJD working on it
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi,

this is how I interpreted it:

"Any unimplemented exceptions..." just means: if the interface uses exceptions that do not exist (yet), you will have to create those exceptions and put them in the suncertify.db package.

Herman
Mary John
Ranch Hand

Joined: Sep 17, 2007
Posts: 109
Thanks Herman. So I guess my interface has all the exceptions already implemented.

Was wondering did anybody have any unimplemented exceptions in their interface provided in assignment.


Thanks
Mary
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by mary john:
Thanks Herman. So I guess my interface has all the exceptions already implemented.

Was wondering did anybody have any unimplemented exceptions in their interface provided in assignment.


Thanks
Mary


Hi,

I don't quite understand.. SUN most probably only sent you their Interface, correct ? So when they say "throw RecordNotFoundException"..

You must create RecordNotFoundException yourself, which means it was unimplemented.

Virtually everyone doing the certification had unimplemented Exceptions to create themselves..

Regards,
Alex
Alexander V Fahrmann
Greenhorn

Joined: Jan 16, 2008
Posts: 22
Originally posted by mary john:
My assignment has the followig sentence in it along with the server interface. Can any one please explain what this means?


Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a String that serves as the exception's description.

My interface has RecordNotFoundException, DuplicateKeyException, SecurityException in it.


My assignment states actually the same.
BTW, does anyone know how to implement an Exception (what
implies that it should be a descendant (maybe not direct)
of the Exception class and, therefore, inherit its constructors (!))
which has not constructors meeting the above-mentioned
(emphasized in [b]bold[b]) requirements?

I am just curious.

P.S.: off-topic: this is my first post on the board - how
to make "preview" before posting?


SCJD, SCBCD, SCWCD
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by Alexander V Fahrmann:


My assignment states actually the same.
BTW, does anyone know how to implement an Exception (what
implies that it should be a descendant (maybe not direct)
of the Exception class and, therefore, inherit its constructors (!))
which has not constructors meeting the above-mentioned
(emphasized in [b]bold[b]) requirements?

I am just curious.

P.S.: off-topic: this is my first post on the board - how
to make "preview" before posting?


Any class you create only ever have the no-args constructor by default..
So the requirements tells you to create an additional constructor that accepts a String..
When you specifically create a constructor, the default one is no longer created by default (you must then create the default one manually too).

Constructors are not inherited... It's just that the default behavior of the default constructor is to call super()..

There is no preview option as far as I know, but you can edit your post with the "Edit" button just over your post.

Regards,
Alex
[ February 14, 2008: Message edited by: Alex Belisle Turcot ]
Mary John
Ranch Hand

Joined: Sep 17, 2007
Posts: 109
hi all,
thanks for replies.

thanks alex, your comment was helpful.

The way I understand it is, since RecordNotFoundException is not in the java core API implementation we need to create this class. So is the case with DuplicateKeyException(I was under the impression that these classes are already there in the java API, based on some google results that I got with search for these exceptions, But I checked in the java 6 API and could not find it) which means I have to create it.

But regarding SecurityException: I see that it is implemented in the java.lang package. So I dont have to implement it, is that right??
\

Thanks. Please correct meif I have misunderstood this.

mary
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by mary john:

But regarding SecurityException: I see that it is implemented in the java.lang package. So I dont have to implement it, is that right??


correct
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hmmm,

maybe not correct if you look at the javadoc of the SecurityException: "Thrown by the security manager to indicate a security violation."

I made my own SecurityException and explained it in the choices.txt

Herman
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by Herman Scheltinga:
hmmm,

maybe not correct if you look at the javadoc of the SecurityException: "Thrown by the security manager to indicate a security violation."

I made my own SecurityException and explained it in the choices.txt

Herman


oh! very good point! Since it doesn't match the purpose at all in our/your case.
Ciaran Cahill
Greenhorn

Joined: Aug 03, 2007
Posts: 10
Hi guys,
Just on a related issue, in my database class I am implementing the interface given by Sun. However I also need to throw extra execptions in addition to the ones in the interface. The way I am getting around this is to create a subclass of RuntimeException, which allows me to throw the extra exception... because it's not checked.
Is this acceptable? Nearly all of my other exceptions are checked exceptions (they extend Exception directly).
 
Don't get me started about those stupid light bulbs.
 
subject: about unimplemented exceptions