Getting the Methods of a Class Object: By obtaining a list of all public methods, both declared and inherited.
import java.lang.reflect.Method; public class Main { public static void main(String[] argv) throws Exception { Class cls = java.lang.String.class; Method[] methods = cls.getMethods(); for (int i = 0; i < methods.length; i++) { Class returnType = methods[i].getReturnType(); Class[] paramTypes = methods[i].getParameterTypes(); System.out.println(methods[i]); } } }