Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/java/jvm/memory-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ String str4 = new StringBuilder().append(str1).append(str2).toString();
final String str1 = "str";
final String str2 = "ing";
// 下面两个表达式其实是等价的
String c = "str" + "str2";// 常量池中的对象
String c = "str" + "ing";// 常量池中的对象
String d = str1 + str2; // 常量池中的对象
System.out.println(c == d);// true
```
Expand All @@ -377,7 +377,7 @@ System.out.println(c == d);// true
```java
final String str1 = "str";
final String str2 = getStr();
String c = "str" + "str2";// 常量池中的对象
String c = "str" + "ing";// 常量池中的对象
String d = str1 + str2; // 在堆上创建的新的对象
System.out.println(c == d);// false
public static String getStr() {
Expand Down