This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You asked for it, here you got it. That is JavaRanch. 0: ldc #2; //String spring When the JVM finds the first use of an entry in the constant pool of the class, that corresponds to a string literal; it creates a String object and interns it. One string object s1 = "spring ". 14: ldc #6; //String summer The same happens here. Two string objects "summer ". 19: invokevirtual #7; //Method java/lang/StringBuffer.toString: The string buffer appends both strings and is converted to a new string object s2 = "spring summer ". 24: ldc #8; //String fall Four strings "fall ". 26: invokevirtual #9; //Method java/lang/String.concat: Five string objects "spring fall ". Though this one is eligible for gc. it is still created. 32: invokevirtual #9; //Method java/lang/String.concat: Six string objects "spring summer spring ". This is neither pointed to by a reference. 47: ldc #10; //String winter Seven "winter ". 52: invokevirtual #7; //Method java/lang/StringBuffer.toString Eight s1 = "spring winter ". 70: ldc #12; //String Nine " ". 79: invokevirtual #7; //Method java/lang/StringBuffer.toString Finally ten strings were created "spring winter spring summer ".