Let's say you need to call SimpleClass.simpleMethod(int x);
Method m =
SimpleClass.class.getDeclaredMethod("simpleMethod", Integer.TYPE); m.setAccessible(true); //if security settings allow this Object o = m.invoke(null, 20); //use null if the method is static
No comments:
Post a Comment