Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access specifier

 
Sagar Sharma
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can classes have access specifier other than 'public' and 'no specifier - friendly' specifiers
 
atin sehgal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Top level class could be abstract,final,public
or none(i.e. package or default specifier)
regds
Nm
------------------
"Knowledge is Power"****************MY SCJP RESOURCES
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
just to add ---
non top level class can be private also.

regards
deekasha

[This message has been edited by deekasha gunwant (edited January 15, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic