• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.....

 
devika cha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a class be private?
 
raghavendra
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
only inner classes can be private.
nested-top level classes cannot be private
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic