Java has string pool, due to which objects of string class are immutable.
But my question stands -
What was the need to make String POOL?
When we compiler see's that a new String literal has to be created,it first check's the pool for an identical string,if found no new String literal is created,the existing String is referred.