I know that using most of String's methods will return a new string object which is added to the string pool and that the string literals passed as arguments to these methods also are added to the string pool.
For example the code below will create three string objects namely: "Hello ", ""World!"" and "Hello World!" which are added to the string pool implying that the argument passed to concat() method is added to the string pool.
What I am curious to know whether the string literal arguments passed to StringBuilder.append() method and any other methods in StringBuilder are added to the string pool.
Or maybe I should ask whether all string literal arguments that are passed to any other method in any other class also are added to the string pool ?
I also want to add the I know these facts based on java 6.
String s = "Hello " ;
s = s.concat("World!") ;
Copyright License:
Author:「user9349193413」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/25232220/does-stringbuilder-append-method-fill-up-the-string-pool