Skip to content

Commit 6de1dae

Browse files
authored
Create memory-area.md
1 parent 28db32c commit 6de1dae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/java/jvm/memory-area.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ String str4 = new StringBuilder().append(str1).append(str2).toString();
363363
final String str1 = "str";
364364
final String str2 = "ing";
365365
// 下面两个表达式其实是等价的
366-
String c = "str" + "str2";// 常量池中的对象
366+
String c = "str" + "ing";// 常量池中的对象
367367
String d = str1 + str2; // 常量池中的对象
368368
System.out.println(c == d);// true
369369
```
@@ -377,7 +377,7 @@ System.out.println(c == d);// true
377377
```java
378378
final String str1 = "str";
379379
final String str2 = getStr();
380-
String c = "str" + "str2";// 常量池中的对象
380+
String c = "str" + "ing";// 常量池中的对象
381381
String d = str1 + str2; // 在堆上创建的新的对象
382382
System.out.println(c == d);// false
383383
public static String getStr() {

0 commit comments

Comments
 (0)