File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes restricting methods access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "restricting methods access" Watch "restricting methods access" New topic
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: 29219
    
134

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: restricting methods access
 
Similar Threads
access specifier and access modifier
Constructors
Access specifiers & Access Modifiers
basic question on access modifiers and levels
database in netbeans