This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes about access specifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about access specifiers" Watch "about access specifiers" New topic
Author

about access specifiers

Santhi Bharath
Ranch Hand

Joined: Jun 03, 2008
Posts: 75
why can't we give private and protected specifiers for a class
while i am trying to give the specifires i got an error?

can any body explain me why ? thanks in advance


thanks and regards<br />Santhi Bharath<br />SCJP 5.0, SCWCD 5.0
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38515
    
  23
That comes up quite frequently. Look at this thread. I can't seem to find any more useful threads. Please ask again if you don't understand.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14117
    
  16

Access control keywords such as "protected" and "private" are for class members only. Top-level classes are not members of any class.

Suppose you could make a top-level class private, then what is that supposed to mean?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
Don't get me started about those stupid light bulbs.
 
subject: about access specifiers