This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes access specifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "access specifier" Watch "access specifier" New topic

access specifier

Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
can classes have access specifier other than 'public' and 'no specifier - friendly' specifiers
atin sehgal
Ranch Hand

Joined: Nov 12, 2000
Posts: 32
Yep and No...
A top level class/interface has to be public.
if u try to compile a top level class with access modifier as default or say protected it gives error..
But if a class is not top level class then it can be protected/default....
Hope I am right.
But abt top level thing I am sure that it has to be public..Cannot be any other thing..

Originally posted by Sagar Sharma:
can classes have access specifier other than 'public' and 'no specifier - friendly' specifiers

N Mukherjee
Ranch Hand

Joined: Jun 08, 2000
Posts: 141
Top level class could be abstract,final,public
or none(i.e. package or default specifier)
"Knowledge is Power"****************MY SCJP RESOURCES

"Knowledge is Power"****************<A HREF="" TARGET=_blank rel="nofollow">THREAD/SCJP RESOURCES</A>
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
just to add ---
non top level class can be private also.


[This message has been edited by deekasha gunwant (edited January 15, 2001).]
I agree. Here's the link:
subject: access specifier