Skip to content

Instantly share code, notes, and snippets.

@dmerejkowsky
Created March 18, 2016 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmerejkowsky/2546666167314e09f556 to your computer and use it in GitHub Desktop.
Save dmerejkowsky/2546666167314e09f556 to your computer and use it in GitHub Desktop.
Calling private methods in Java
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