File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 2
2
《《《 [ 上一节] ( 01_Generics.md )
3
3
4
4
### 装箱与拆箱
5
- - 回想一下,` Java ` 中的每种类型都是引用类型或基本类型。 引用类型是任何类,接口或数组类型。 所有引用类型都是` Object ` 类的子类型,
6
- 任何引用类型的变量都可以设置为 ` null ` 。 如下表所示,有八种基本类型,每种都有相应的类库的引用类型。 类库位于` java.lang ` 包:
5
+ 回想一下,` Java ` 中的每种类型都是引用类型或基本类型。 引用类型是任何类,接口或数组类型。 所有引用类型都是` Object ` 类的子类型,任何引用类型的变量都
6
+ 可以设置为 ` null ` 。 如下表所示,有八种基本类型,每种都有相应的类库的引用类型。 类库位于 ` java.lang ` 包:
7
7
8
- 原始类型 | 引用类型
9
- ---|---
10
- `byte` |`Byte`
11
- `short` |`Short`
12
- `int` |`Integer`
13
- `long` |`Long`
14
- `float` |`Float`
15
- `double` |`Double`
16
- `boolean` |`Boolean`
17
- `char` |`Character`
8
+ 原始类型 | 引用类型
9
+ ---|---
10
+ ` byte ` |` Byte `
11
+ ` short ` |` Short `
12
+ ` int ` |` Integer `
13
+ ` long ` |` Long `
14
+ ` float ` |` Float `
15
+ ` double ` |` Double `
16
+ ` boolean ` |` Boolean `
17
+ ` char ` |` Character `
18
18
19
19
- 将原始类型转换为相应的引用类型称为装箱,并将引用类型转换为相应的原始类型称为拆箱。
20
20
You can’t perform that action at this time.
0 commit comments