The string is Immutable in Java because String objects are cached in the String pool. ... Another reason why String class is immutable could die due to HashMap. Since Strings are very popular as the HashMap key, it's important for them to be immutable so that they can retrieve the value object which was stored in HashMap.