| Author |
restricting methods access
|
Randy Smith
Ranch Hand
Joined: Mar 27, 2011
Posts: 44
|
|
Hi guys,
how can I restrict method access to certain classes? some sample codes will be very useful
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26151
|
|
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.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Randy Smith
Ranch Hand
Joined: Mar 27, 2011
Posts: 44
|
|
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
|
 |
 |
|
|
subject: restricting methods access
|
|
|