JLS 3.10.5 String Literals: "Moreover, a string literal always refers to the same instance of class String. This is because string literals - or, more generally, strings that are the values of constant expressions (§15.28) - are "interned" so as to share unique instances, using the method String.intern"
По
JLS §15.28 concat() не подходит под определение константных выражений, и код ниже ожидаемо возвращает false.
String str1 = "Hello".concat("World");
String str3 = new String("HelloWorld"); //Line-2
String str2 = str1.intern();
System.out.println(str1 == str2); //false
Но если убираем Line-2, то str1 == str2 вернет true.
Почему в этом случае str1 указывает в string pool, а первом варианте не указывает?