Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes WHY cant a class be declared as private? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "WHY cant a class be declared as private?" Watch "WHY cant a class be declared as private?" New topic
Author

WHY cant a class be declared as private?

Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
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

Joined: Jul 11, 2001
Posts: 14112
Please continue discussion at this thread


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WHY cant a class be declared as private?
 
Similar Threads
Class cannot be protected (or) static ?
Why a basic regular class cannot be private and protected
can classes be private or protected says RHE
public declaration in methods
Protected Class