• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Class modifiers

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good observation. Boone is not referring to nested classes when he says that. Non-local nested classes can be static, private and protected.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic