Java tutorial
import java.lang.reflect.Method; public class Main { public static void main(String[] args) throws Exception { Main cls = new Main(); Class c = cls.getClass(); // parameter type is null Method m = c.getMethod("show", null); System.out.println("method = " + m.toString()); // method Long Class[] cArg = new Class[1]; cArg[0] = Long.class; Method lMethod = c.getMethod("showLong", cArg); System.out.println("method = " + lMethod.toString()); } } class MyClass { public Integer show() { return 1; } public void showLong(Long l) { this.l = l; } long l = 1L; }