阅读背景:

java 反射调用有参方法,并传递参数

来源:互联网 
Class<?> cla=Class.forName(classpath);
Object o = cla.newInstance();
//下面两种方法是等效的,并注意method.invoke方法参数是可变
//Method method = cla.getMethod(requestParam,String.class,int.class);
method.invoke(o, new Object[] {request  ,response});
Method method = Method method = cla.getMethod(requestParam,new Class[]{String.class,int.classs});
method.invoke(o, new Object[] {"myname",888});Class<?> cla=Class.forName(classpath);
Object o



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: