---
title: "Java中难以理解的知识点汇集"
author: "software_developer"
date: "2012-07-12T10:18:55Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2012-07-12T10:18:55Z"
id: 1585890
url: "https://software-developer.iteye.com/blog/1585890"
---

1，JDK5引入的针对原始类型的自动装箱和自动拆箱

     

```
Integer a = 100;
Integer b = 100;
System.out.println(a == b) >> true;
Integer c = 200;
Integer d = 200;
System.out.println(c == d) >> false
原因：
整形：-128~127 比较int原始类型，超出了这个范围则比较Integer类型
```

 

 2，针对原始类型的封装类中class和TYPE属性的说明

   

```
Integer.class表示的是Integer类对应的类对象
Integer.TYPE表示的是int类对应的类对象

System.out.println(int.class == Integer.TYPE)--->true
System.out.println(int.class == Integer.class)--->false
```