• Post Reply Bookmark Topic Watch Topic
  • New Topic

I don't want classes outside of this package to see this class  RSS feed

 
Steven Greenbaum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want classes outside of I want to hide this class from the outside world but want it available to  other classes within the package.
How do I do that?
Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leave off the public keyword on the class declaration.

The "default" access limits the class to the current package and derived classes.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
default access is also known as "package private" access, meaning that the widest visibility it has is at the package level.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!