|
Mar
14
|
Reflection allows you to find all the methods of a class using the Class class and it’s getMethods() methods. Clearest way to explain is with an example.
String className = "java.lang.String";
Class clazz = Class.forName(className);
Method[] methods = clazz.getMethods();
for (Method method : methods)
{
String methodName = method.getName();
System.out.println(methodName);
}



Recent Comments