00000004.htm
来自「水木清华BBS」· HTM 代码 · 共 59 行
HTM
59 行
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: wingzhang (scott), 信区: Java <BR>标 题: Re: 有关于Method getMethod(String,Class[])方法求助 <BR>发信站: BBS 水木清华站 (Mon Mar 8 10:43:49 1999) <BR> <BR>【 在 sheen (星矢胖胖熊-一切都会有的) 的大作中提到: 】 <BR>∶<I> I have try, but the same result: 无法调用此方法 </I><BR> <BR>Can you put out your method signature? <BR>I have passed the following examples: <BR> <BR>import java.lang.reflect.*; <BR> <BR>public class TestM { <BR>public static void main(String[] args){ <BR> try{ <BR> TestM t = new TestM(); <BR> Class c = t.getClass(); <BR> Class[] cargs = new Class[2]; <BR> String[] realArgs = {"aa","bb"}; <BR> cargs[0] = realArgs.getClass(); <BR> Integer in = new Integer(2); <BR> cargs[1] = in.getClass(); <BR> Method m = c.getMethod("test",cargs); <BR> Object[] inArgs = new Object[2]; <BR> inArgs[0] = readArgs; <BR> inArgs[1] = in; <BR> m.invoke(t,inArgs); <BR> }catch(Exception e){System.out.println(e);} <BR>} <BR> <BR> public void test(String[] str,Integer stri){ <BR> for(int j = 0; j < str.length; j ++) <BR> System.out.println(str[j]); <BR> System.out.println(stri.intValue()); <BR>} <BR>} <BR>} <BR> <BR>-- <BR>※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 202.119.38.2] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?