Does StringBuilder.append() method fill up the string pool?

2014-08-11T03:28:37

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

About “Does StringBuilder.append() method fill up the string pool?” questions

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 ...
I'm having trouble understanding the usage of some Java Bytecode Instructions, partially due to lack of examples. Instead, I use javac or Jasmin to compile some regular Java code, and then I use ja...
It's recommended (PMD rule AppendCharacterWithChar) to use StringBuilder.append(char) instead of StringBuilder.append(String). I agree with that. But if I want to append a (short) string like "='"...
The script below will compare two string to see if they are equal. In this case one string is declared and the other string is input from the scanner. I understand why these two string are not equal
I found concatenations of constant string expressions are optimized by the compiler into one string. Now with string concatenation of strings only known at run-time, why does the compiler not opti...
Suppose I have a string 'str'. I want to intern it using String.Intern method. I just wonder, how exactly String.Intern works in case when value of 'str' hasn't been interned yet. The description o...
According to Netbeans hint named Use chain of .append methods instead of string concatenation Looks for string concatenation in the parameter of an invocation of the append method of StringBuild...
I have decompiled a class with javap and I'm seeing some duplicates in the Constant Pool section, like this: #19 = Class #350 // java/lang/StringBuilder ... Some other class
I want to run several scheduled Tasks simultaneously. When configuring spring to do so, I can supply a pool-size to the scheduler: <task:annotation-driven executor="myExecutor" scheduler="
Strings are immutable objects and are stored in the String Pool. Suppose in an application none of the strings are created using new operator. In this case also is it necessary to use equals method

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.