Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

restricting methods access  RSS feed

 
Randy Smith
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

how can I restrict method access to certain classes? some sample codes will be very useful
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a modifier to only allow one class (private), classes in the same package (no modifier), subclasses + classes in the same package (protected) and all classes (public.)

There isn't a way to allow random methods access.
 
Randy Smith
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:You can use a modifier to only allow one class (private), classes in the same package (no modifier), subclasses + classes in the same package (protected) and all classes (public.)

There isn't a way to allow random methods access.


Thank you for the information
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!