Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class accessibility modifier

 
sanpan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody

i want to know why it is not possible to mention a private
and protected access modifier to a top level class
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sanpan,
In both cases the point of the modifer is to limit the use of the class in some manner. A top-level class that can't be extended (private) or is only available to the same package or subclasses (protected) isn't very useful. It makes more sense to create them as members of the classes that actually use them.
Hope that helps.
Note that JavaRanch has a
Name Policy. Please read the policy and re-register under a name that complies with the rules.
Thanks for your co-operation.
Moving this thread to Certifcation Study.

------------------
Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic