Java tutorial
import java.lang.reflect.Method; public class Main { public String methodName(int i) { return "Hello World: " + i; } public static void main(String... args) throws Exception { Main t = new Main(); Method m = Main.class.getMethod("methodName", int.class); String returnVal = (String) m.invoke(t, 5); System.out.println(returnVal); } }