Here you can find the source of getMethods(String classname)
public static String getMethods(String classname) throws ClassNotFoundException
//package com.java2s; /*//from ww w.j a v a2s .c o m Copyright (C) 2007-2016 Michael Goffioul This file is part of Octave. Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ import java.lang.reflect.*; public class Main { public static String getMethods(String classname) throws ClassNotFoundException { return (getMethods(Class.forName(classname))); } public static String getMethods(Object obj) throws ClassNotFoundException { return (getMethods(obj.getClass())); } public static String getMethods(Class klass) { StringBuffer sb = new StringBuffer(); Method theMethod[] = klass.getMethods(); for (int i = 0; i < theMethod.length; i++) { if (i > 0) { sb.append(";"); } sb.append(theMethod[i].getReturnType().getCanonicalName()); sb.append(" "); sb.append(theMethod[i].getName()); sb.append("("); Class theParameter[] = theMethod[i].getParameterTypes(); for (int j = 0; j < theParameter.length; j++) { if (j > 0) { sb.append(", "); } sb.append(theParameter[j].getCanonicalName()); } sb.append(")"); Class theExceptions[] = theMethod[i].getExceptionTypes(); if (theExceptions.length > 0) { sb.append(" throws "); for (int j = 0; j < theExceptions.length; j++) { if (j > 0) { sb.append(", "); } sb.append(theExceptions[j].getCanonicalName()); } } } return (sb.toString()); } }