解决方案 »
- 求JAVA 字符串中如何截取字母
- java3d的mdl格式模型如何载入;java的窗口程序中如何添加帮助信息
- 我是山区农村的孩子,买不起vs。那么Java+mySQL是免费的把?可以用来开发商业程序把?vs好像不行。
- 高分请教一个Socket编程服务器端的问题!
- native方法的使用
- 虚心请教简单问题:java.lang.NullPointerException是如何产生的?应该如何解决?谢谢!
- 如何在applet中调用jni?
- QuickTime for Java高手看过来
- 如何通过java收发邮件?
- 大虾请进!急急急!
- 采用GridBagLayout对按钮进行布局后,按钮的长度随着字体的长度而变化
- java 多线程共享的问题
ADD类里有两个方法
int add(int x,int y){return x + y;} int dec(int x,int y){ return x - y;}
你方法的访问权限不是public的,所以getMethod获取不到,看看API上面对方法的介绍吧。使用getDeclaredMethod获取class声明的所有方法,getMethod只能获取为public的方法
看了看API,正解。getDeclaredMethod(String name, Class<?>... parameterTypes)
Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object.getMethod(String name, Class<?>... parameterTypes)
Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object.