So here it is a simple solution for the same. You can print the count and method headers with this code.
import java.lang.reflect.Method;
/**
*
* @author K.A.N. Nancy
*/
public class CountClassMethods {
public static void main(String args[]){
Class className=null;
try{
className= Class.forName(args[0]);
Method[] methods= className.getMethods();
System.out.println("Number of methods in "+className+" = "+methods.length);
for(int i=0;i<methods.length;i++){
System.out.println(methods[i]);
}
}catch(ClassNotFoundException classNotFoundException){
System.out.println("Class "+className+" could not be found");
}
}
Coded @ Feb 29, 2012 - 4:10 am IST