The following code will list the methods in a class....
import java.lang.reflect.*;
public class ClassDemo5 {
public static void main(String args[]) {
Class cls = java.lang.String.class;
Method methlist[] = cls.getMethods();
for (int i = 0; i < methlist.length; i++)
System.out.println(methlist[i]);
}
}
|