This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why we can't declare private and protected as access specifiers for a class 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 » Java in General
Reply locked New topic
Author

Why we can't declare private and protected as access specifiers for a class

Ramesh Pappala
Ranch Hand

Joined: Sep 14, 2005
Posts: 50
Why we can't use private and protected as access specifiers for a class.
Could you give me an example.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Because you can't. Why can't a variable be declared as both "int" and "double?" Same reason: because it can't.

Please don't start new threads to ask follow-on questions from other threads -- we already discussed this here. I'm going to close this thread; followups in the original thread, please.


[Jess in Action][AskingGoodQuestions]
 
jQuery in Action, 2nd edition
 
subject: Why we can't declare private and protected as access specifiers for a class
 
Similar Threads
Inner classes and inheritance
enum public/protected/default/private
about access specifiers
AccessModifiers and Access Specifiers
Accessibility Modifiers for classes