July 22, 2009 at 2:59 PM
JVM maintains the String Pool.It will refer the String object from pool to achieve the memory efficiency instead of creating the new String objects. So, whenever you create a new string literal, it has to be checked in the pool whether it exists or not.If exist, just give the reference to the same object or create the new object in the pool. There will be many
references point to the same String objects, if someone changes the
value, it will affect all the references.
So, the string object is immutable.