Java Class.getMethods()
Syntax
Class.getMethods() has the following syntax.
public Method [] getMethods() throws SecurityException
Example
In the following code shows how to use Class.getMethods() method.
//from w w w . ja v a 2s . co m
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws Exception {
Class cls = Class.forName("java.awt.Label");
System.out.println("Methods =");
Method m[] = cls.getMethods();
for (int i = 0; i < m.length; i++) {
System.out.println(m[i]);
}
}
}
The code above generates the following result.