Java tutorial
import java.lang.reflect.Method; public class Main { public static void main(String[] args) { Main cls = new Main(); Class c = cls.getClass(); try { Method m = c.getDeclaredMethod("show", null); System.out.println("method = " + m.toString()); // method Integer Class[] cArg = new Class[1]; cArg[0] = Integer.class; Method lMethod = c.getDeclaredMethod("showInteger", cArg); System.out.println("method = " + lMethod.toString()); } catch (NoSuchMethodException e) { System.out.println(e.toString()); } } } class MyClass { private Integer show() { return 1; } public void showInteger(Integer i) { this.i = i; } public int i = 12345; }