BBS水木清华站∶精华区

发信人: wingzhang (scott), 信区: Java        
标  题: Re: 有关于Method getMethod(String,Class[])方法求助 
发信站: BBS 水木清华站 (Sun Mar  7 10:07:32 1999) 
 
【 在 sheen (星矢胖胖熊-一切都会有的) 的大作中提到: 】 
 thisMethod.invoke(thisClass, new Object[] {InParam,new Integer(OutParamNum)}) 
                                            ~~~~~~为String[],而不是String, 
 所以不能用new String(InParam),程序运行到此句就停, 
 what should I do? 
 help! 
 多谢各位,多谢! 
you may try as following: 
 
Object[] realArgs = new Object[2]; 
String[] strArgs = {"aa","bb"}; 
Integer intArgs = ....; 
realArgs[0] = strArgs; 
realArgs[1] = intArgs; 
thisMethod.invoke(thisClass,realArgs); 
.. 
 
-- 
※ 修改:·wingzhang 於 Mar  7 10:15:08 修改本文·[FROM:    202.119.38.2] 
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 202.119.38.2] 

BBS水木清华站∶精华区