aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class modifiers" Watch "Class modifiers" New topic
Author

Class modifiers

Greg Torrance
Greenhorn

Joined: Feb 25, 2000
Posts: 17
Greetings,
Class modifiers ... can somebody help clarify something for me? It seems to be generally accepted that the modifiers for classes do not include static, protected and private. In fact Brogden says "Classes cannot be protected, private, native, static, or synchronized." It seems to me this is always true for native and synchronized, and true for the others when the class in question is a top-level "package" class, but what about nested and inner classes?
Either of these can have protected and private accessibility (in addition to public and the default package accessibility that top-level "package" classes can have). In addition, (static) top-level nested classes are declared with the static keyword, so surely static is allowable also (in this particular case)?!?!
How should one go about answering a question that asks if static is an acceptiable modifier for classes? [I came across one in the IBM test, and I still don't know what they were expecting.]
Thanks,
Greg
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
Good observation. Boone is not referring to nested classes when he says that. Non-local nested classes can be static, private and protected.

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class modifiers