File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Private 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 "Private "class" ??" Watch "Private "class" ??" New topic
Author

Private "class" ??

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
On the Marcus Green exam #2, question 57, he asks if the following is true:
"Under no circumstances can a class be defined with the private modifier"
His answer is that the above statement is false. Now, I know that top-level classes can't be private or protected, so that's not my question. What I am confused about is this: when you see the word "class" (without mention of inner, nested, or anonymous), does that always mean top-level classes, only?? I'm taking the exam tomorrow, so I worry about such things.
chetan nain
Ranch Hand

Joined: Jun 21, 2000
Posts: 159
Dab,
no, i think mention of "class" does not guarantee it to be a top level class. for example, there may be a case of subclassing a class with "default" access. in this case, compiler would require us to declare the extending class to be either "protected" or "private". did i get you correctly?
HTH
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
HTH,
I was meaning top-level versus nested, inner, or anonymous; I wasn't meaning superclass versus subclasses.
A top-level (i.e., not an inner...) can only have default or public access. But inner and nested classes can be have public, protected, default, or private access.
I'll just take the lone word "class" in context the best that I an on the exam!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Private "class" ??