Created
March 18, 2016 23:16
-
-
Save dmerejkowsky/2546666167314e09f556 to your computer and use it in GitHub Desktop.
Calling private methods in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Method; | |
Foo foo = new Foo(); | |
Method method = Foo.class.getDeclaredMethod("private") | |
method.setAccessible(true); | |
method.invoke(foo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment