JAVA之 int.class 与 Integer.class 的关系



 public class Test {
		public static void main(String[] args) {
			Class a = int.class;
			Class b = Integer.TYPE;
			Class c = Integer.class;
			System.out.println(System.identityHashCode(a));
			System.out.println(System.identityHashCode(b));
			System.out.println(System.identityHashCode(c));
		}
}

结果为:

366712642
366712642
1829164700

结论:
int.class = Integer.Type ≠ Integer.class

发布了14 篇原创文章 · 获赞 1 · 访问量 241

猜你喜欢

转载自blog.csdn.net/qq_41976749/article/details/105099245