File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Access Modifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Access Modifier" Watch "Access Modifier" New topic

Access Modifier

Sulbha Jan
Ranch Hand

Joined: Jan 02, 2005
Posts: 37
Hello All,
Is there a way to find out programmatically, the access modifier of a method before actually using it...?

Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Here is the code

LINE X : Check this link to see the constant values for all the modifiers.
click me

Just FYI, this is way out of SCJP objective scope.

[ January 09, 2005: Message edited by: Jay Pawar ]
[ January 09, 2005: Message edited by: Jay Pawar ]

Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Sulbha Jan
Ranch Hand

Joined: Jan 02, 2005
Posts: 37
Thanks a bunch
Bert Bates

Joined: Oct 14, 2002
Posts: 8805
Sulbha, et. al.,

Just in case, after all of Jay's wonderful code, you guys didn't catch this...

It's NOT on the exam... phewww!

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
It is sorta covered in the JavaRanch Style Guide.
subject: Access Modifier
Similar Threads
Overriden Method Query
basic question on access modifiers and levels
access specifier and access modifier
Access specifiers & Access Modifiers