需求:通过该方法运行任意类的任意有参数与无参数的方法
public class Test1 {
public static void main(String[] args) {
try {
Class<?> c=Class.forName("testRef.Test2");
Method[] methods=c.getDeclaredMethods();
for(int i=0;i<methods.length;i++) {
Method method=methods[i];
if(method.getGenericParameterTypes().length!=0) {
@SuppressWarnings("rawtypes")
Class[]types=method.getParameterTypes();