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 Programmer Certification (SCJP/OCPJP) and the fly likes ..... 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "....." Watch "....." New topic
Author

.....

devika cha
Greenhorn

Joined: Dec 17, 2003
Posts: 23
Can a class be private?
raghavendra
Greenhorn

Joined: Apr 12, 2000
Posts: 16
only inner classes can be private.
nested-top level classes cannot be private
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

Top level classes can ONLY be "public"
or (so called) "friendly" ie; without
any access modifier.
NOT "private"
NOT "protected"
Again... summing up ...
Regds.
- satya
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Nested top-level classes, i.e. static member classes or so-called "static inner" classes, certainly can be private. Non-nested top-level classes ("normal" or package-level classes) must be public or default.


"I'm not back." - Bill Harding, Twister
 
Consider Paul's rocket mass heater.
 
subject: .....