Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to access private method of an inner class using reflection.

843789Jul 13 2009 — edited Jul 15 2009
Can somebody tell me that how can i access private method of an inner class using reflection.

There is a scenario like

class A
{
class B
{
private fun() {
--------------
--------------
}
}
}

now i want to use method fun() of an inner class inside third class i.e "class c".
Can i use reflection in someway to access this private method fun() in class c.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2009
Added on Jul 13 2009
9 comments
1,851 views