Can anyone clear some doubts on
String literal pool working.
I think when a JVM loads a class, it will search for all String literals in it, and store it in pool (will check existence of same value in pool first).
But if we write like
String s1 = new String("abc"); or
StringBuffer sb1 = new StringBuffer("def")
both "abc", and "def" will be saved in heap (not in pool).
I doubt what will happen if we have a code like this
s1= s1.append("xyz");, will "xyz" get saved in literal pool?