This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exceptions created as member classes of package  RSS feed

 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Simon Cockayne
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!