Skip to content

Commit eca45d8

Browse files
committed
Merge branch 'main' of github.com:wemanclh/JavaBasic into main
2 parents dfd259c + ff09370 commit eca45d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

zh-cn/section1.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ boolean 只有两个值:true、false,可以使用 1 bit 来存储,但是
1818
基本类型都有对应的包装类型,基本类型与其对应的包装类型之间的赋值使⽤⾃动装箱与拆箱完成。
1919

2020
```java
21-
Integer x = 2; // 装箱 调⽤用了了 Integer.valueOf(2)
22-
int y = x; // 拆箱 调⽤用了了 X.intValue()
21+
Integer x = 2; // 装箱 调⽤用了 Integer.valueOf(2)
22+
int y = x; // 拆箱 调⽤用了 X.intValue()
2323
```
2424
## 缓存池
2525

2626
new Integer(123) 与 Integer.valueOf(123) 的区别在于:
2727

2828
- new Integer(123) 每次都会新建⼀一个对象;
29-
- Integer.valueOf(123) 会使⽤用缓存池中的对象,多次调⽤用会取得同⼀一个对象的引用。
29+
- Integer.valueOf(123) 会使用缓存池中的对象,多次调⽤用会取得同⼀一个对象的引用。
3030

3131
```java
3232
Integer x = new Integer(123);

0 commit comments

Comments
 (0)