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?
Refer following links:
Questions about Java's String pool
Some queries regarding Java String Pool
Regarding Java String Constant Pool
and, you'll get your answer.
In one sentence, the answer is to use JVM memory cleaverly
to use JVM memory cleaverly