I have a Dummy class that has a private method called sayHello. I want to call sayHello from outside Dummy. I think it sh
If you want to pass any parameter to private function you can pass it as second, third..... arguments of invoke function. Following is sample code.
Method meth = obj.getClass().getDeclaredMethod("getMyName", String.class);
meth.setAccessible(true);
String name = (String) meth.invoke(obj, "Green Goblin");
Full example you can see Here