File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Exceptions created as member classes of package 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 "Exceptions created as member classes of package" Watch "Exceptions created as member classes of package" New topic
Author

Exceptions created as member classes of package

Simon Cockayne
Ranch Hand

Joined: Dec 09, 2000
Posts: 214
Hi,

My assignment states:

"Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package"

Call me dim, but this statement is confusing me.

A member class is surely a member of a class not a package.

Cheers,

Simon


SCJP 1.4 (93%)<br />SCJD (In progress. It can run, but it can't hide...)
Simon Cockayne
Ranch Hand

Joined: Dec 09, 2000
Posts: 214
...and by the way...

I interpeted the instructions to mean:

1) Create RecordNotFoundException.java under suncertify.db that declares

class RecordNotFoundException extends Exception {...}

and

2) Create DuplicateKeyException .java under suncertify.db that declares

class DuplicateKeyException extends Exception {...}

Si
Simon Cockayne
Ranch Hand

Joined: Dec 09, 2000
Posts: 214
Answered my own question.

JLS
http://java.sun.com/docs/books/jls/first_edition/html/6.doc.html#34993

states:

"A member of a package (�7) is a subpackage (�7.1), or a class (�8) or interface (�9) type declared in a compilation unit (�7.3) of the package."

So exception "created as a member class of a package", would simply be declared as a class in the package (not as a member of another class within that package)

right?


Si
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
So exception "created as a member class of a package", would simply be declared as a class in the package (not as a member of another class within that package)


Yes, that's how I would interpret it. That is, if you want your own "RecordNotFoundException" class then stick it in the suncertify.db package.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exceptions created as member classes of package