Skip to content

Commit

Permalink
Merge pull request Snailclimb#1189 from BruceLeeChina/master
Browse files Browse the repository at this point in the history
包装类和常量池部分内容修改
  • Loading branch information
Snailclimb authored May 13, 2021
2 parents 137ed71 + 8a2e872 commit 95ee1be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/java/basis/Java基础知识.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ Integer i2 = new Integer(40);
System.out.println(i1==i2);
```

`Integer i1=40` 这一行代码会发生拆箱,也就是说这行代码等价于 `Integer i1=Integer.valueOf(40)` 。因此,`i1` 直接使用的是常量池中的对象。而`Integer i1 = new Integer(40)` 会直接创建新的对象。
`Integer i1=40` 这一行代码会发生装箱,也就是说这行代码等价于 `Integer i1=Integer.valueOf(40)` 。因此,`i1` 直接使用的是常量池中的对象。而`Integer i1 = new Integer(40)` 会直接创建新的对象。

因此,答案是 `false` 。你答对了吗?

Expand Down

0 comments on commit 95ee1be

Please sign in to comment.