提交 437abe68 编写于 作者: G guide

Update Java内存区域.md

上级 2c1d1704
......@@ -615,7 +615,7 @@ System.out.println(i4 == i5 + i6);// true
System.out.println(40 == i5 + i6);// true
```
`i1`, `i2 ``i3` 都是常量池中的对象,`i4``i5` , `i6` 是堆中的对象。
`i1` , `i2 ` , `i3` 都是常量池中的对象,`i4` , `i5` , `i6` 是堆中的对象。
`i4 == i5 + i6` 为什么是 true 呢?因为, `i5``i6` 会进行自动拆箱操作,进行数值相加,即 `i4 == 40``Integer` 对象无法与数值进行直接比较,所以 `i4` 自动拆箱转为 int 值 40,最终这条语句转为 `40 == 40` 进行数值比较。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册