File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WHY cant a class be declared as private?

 
Chhaya Dhanani
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
Why we can give private and protected access controller to inner
classes only? Why not to outer class? Why java is stopping us from
doing that?
i understand that it does not make the class available to the JVM in case we declare it as private.
but then accdg to the access specifiers.. if no specier is mentioned itis taken as "friendly" or default" and this specifier makes it available only to the package and subclasses outside the package..
so how come classes with no specifier run properly where as classes declared as private or protected run smoothly ??
Chhaya
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please continue discussion at this thread
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic