int.class 和Integer.class不是相同的class对象
来源:互联网 发布:苹果解锁软件下载 编辑:程序博客网 时间:2024/06/07 06:28
今天用反射的方法调用framework框架层的方法
Class<?> cls=Class.forName(className);
Method method=cls.getDeclaredMethod(methodName, new Class<?>[]{Integer.class});
老是出现
java.lang.NoSuchMethodException
异常
改写成
Class<?> cls=Class.forName(className);
Method method=cls.getDeclaredMethod(methodName, new Class<?>[]{int.class});
就可以正常调用了
由此可见
int.class和Integer.class返回的class对像是不一样的
0 0
- int.class 和Integer.class不是相同的class对象
- int.Class和integer.class不是一回事
- int.class和Integer.class
- int.class和Integer.class有何不同?
- 一句话博客: int.class = Integer.TYPE !=Integer.class
- class类和对象
- Java中的Class类和Class对象
- new class[] = {int.class}
- jquery 相同ID, 相同class的区别
- 对象.class 和对象.getClass() 的区别
- Class对象以及泛化的Class引用
- Java的Class对象
- Class对象的泛化
- class和struct的不同和相同 ---.net 学习
- Class不是对象,用assign修饰
- Class<T>和Class<?>
- Class.forName 和 .class
- class
- jira修改日期格式
- UVA 1546 - Complete the sequence!(差分法)
- 07 内置对象
- 【详细教程】编译openwrt + njit-client 1.3 通过iNode认证
- CodeForces 1A
- int.class 和Integer.class不是相同的class对象
- VS2010版快捷键
- 基于spark_streaming的logistic流式机器学习
- C.5
- JSP简单练习-猜字母游戏
- Android学习笔记之AndroidManifest.xml文件解析
- hibernate4 注解 @DynamicInsert 和 @DynamicUpdate
- 大小端模式详解
- JSP中文乱码的几种解决方法