Question: why java string is immutable?
Answer: Why String is Immutable or Final in Java. The string is Immutable in Java because String objects are cached in String pool. ... Since Strings are very popular as HashMap key, it's important for them to be immutable so that they can retrieve the value object which was stored in HashMap.