This is one of the most popular String Interview questions in Java, which starts with discussion of, What is String, How String in Java is different than String in C and C++, and then shifted towards what is immutable object in Java , what are the benefits of immutable object , why do you use it and which scenarios do you use it. This is some time also asked as "Why String is final in Java" . Though there could be many possible answer for this question, and only designer of String class can answer this , I think below two does make sense 1) Imagine StringPool facility without making string immutable , its not possible at all because in case of string pool one string object/literal e.g. Why String is immutable in Java
Oracle Oracle Oracle Technology Network Java Code Conventions for the Java TM Programming Language Revised April 20, 1999
Why use inner classes in java Q: So what are inner classes good for anyway?
History As of 2006[update], the modification of the class file format is being considered under Java Specification Request (JSR) 202. File layout and structure Sections Java class file