I\'ve got a question of some strange String pool behavior.
I\'m using == to compare equal Strings to find out whether they\'re in the pool or not.
p
"555" + ""
is a compile-time constant, whereas
giveLiteralString() + ""
isn't. Therefore the former compiles into just the string constant "555" and the latter compiles into the actual method invocation and concatenation, resulting in a fresh String instance.
Strings computed by concatenation at run time are newly created and therefore distinct.