java.lang.Class.getMethod() java.lang.Class.getInterfaces() java.lang.Class.getMethods() java.lang.Class.getMethod() package com.codingdict; import java.lang.reflect.*; public class ClassDemo { public static void main(String[] args) { ClassDemo cls = new ClassDemo(); Class c = cls.getClass(); try { // parameter type is null 方法 m = c.getMethod("show", null); System.out.println("method = " + m.toString()); } catch(NoSuchMethodException e) { System.out.println(e.toString()); } try { // method Long Class[] cArg = new Class[1]; cArg[0] = Long.class; 方法 lMethod = c.getMethod("showLong", cArg); System.out.println("method = " + lMethod.toString()); } catch(NoSuchMethodException e) { System.out.println(e.toString()); } } public Integer show() { return 1; } public void showLong(Long l) { this.l = l; } long l = 78655; } java.lang.Class.getInterfaces() java.lang.Class.getMethods()