String Concat With Same Reference? [duplicate]
问题 This question already has answers here : a confusion about java String literal pool and String's concatenation (4 answers) When should we use intern method of String on String literals (13 answers) Closed 3 years ago . Here is my code and I am now quite confuse about String pool and Heap storage by this output. public class String1 { public static void main(String[] args) { // TODO Auto-generated method stub String str = "abcd"; String str1 = "" ; str1=str1+"abcd"; if(str.equals(str1)) System