标签:character 需要 height order int 使用 style 存储空间 cti
1.声明方式不同,基本类型不适用new关键字,而包装类型需要使用new关键字来在堆中分配存储空间;
2.存储方式及位置不同,基本类型是直接将变量值存储在堆栈中,而包装类型是将对象放在堆中,然后通过引用来使用;
3.初始值不同,基本类型的初始值如int为0,boolean为false,而包装类型的初始值为null
4.使用方式不同,基本类型直接赋值直接使用就好,而包装类型在集合如Collection、Map时会使用到。
| 基本类型 | 包装器类型 |
| boolean | Boolean |
| char | Character |
| int | Integer |
| byte | Byte |
| short | Short |
| long | Long |
| float | Float |
| double | Double |
标签:character 需要 height order int 使用 style 存储空间 cti
原文地址:http://www.cnblogs.com/dmfcjd/p/7520604.html