Method cMethod = c.getMethod(strMethodName, new java.lang.Class[]{parameterTypesClass});
cMethod.invoke(o, new Object[]{parameter});搞定!
cMethod.invoke(o, new Object[]{parameter});搞定!
解决方案 »
- 关于九九乘法表的最后一个的显示问题,大家都看看,有新的可以贴贴
- JAVA新手的困惑
- 能否在运行时知道变量的名字?
- Installanywhere 5.5 的注册码
- string类型
- !!!菜鸟在线等,java基础类库中有没有办法将String类数组一次性写入文件?
- outOfMemoryError一般怎样改正?
- 在JList中怎样加一个隐藏值呀!各位大侠请帮忙呀!
- 哪位可以给我说一下在JAVA中应如何链到SYBASE数据库(JDBC方法)
- 如何把JAVA应用程序窗口上的咖啡杯图标换掉?(记得有人提过这个问题的,但是找不到了)
- 帮助我吧,这里有一份解答,是不是正确?帮我改一改,让人看不出一样就好了
- 关于事件!
static final String usage =
"usage: \n" +
"ShowMethods qualified.class.name\n" +
"To show all methods in class or: \n" +
"ShowMethods qualified.class.name word\n" +
"To search for methods involving 'word'";
public static void main(String[] args) {
if(args.length < 1) {
System.out.println(usage);
System.exit(0);
}
try {
Class c = Class.forName(args[0]);
Method[] m = c.getMethods();
Constructor[] ctor = c.getConstructors();
if(args.length == 1) {
for (int i = 0; i < m.length; i++)
System.out.println(m[i]);
for (int i = 0; i < ctor.length; i++)
System.out.println(ctor[i]);
} else {
for (int i = 0; i < m.length; i++)
if(m[i].toString()
.indexOf(args[1])!= -1)
System.out.println(m[i]);
for (int i = 0; i < ctor.length; i++)
if(ctor[i].toString()
.indexOf(args[1])!= -1)
System.out.println(ctor[i]);
}
} catch(ClassNotFoundException e) {
System.err.println("No such class: " + e);
}
}
}