Java的反射机制-动态调用对象的方法
复制代码
package com.beidou.test;
import java.lang.reflect.Method;
public class Dynamic {
public static void main(String[] args) throws Exception{
Class c = Dynamic.class;//得到对象
Method[] methods = c.getDeclaredMethods();//得到方法
for(Method method : methods){
System.out.print(method.getName());//打印参数名
Class[] parameterTypes = method.getParameterTypes();
for(int i=0;i