Why String is immutable in Java. 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. Java Coding Conventions. Why use inner classes in java. Q: So what are inner classes good for anyway?
A: Inner classes nest within other classes. A normal class is a direct member of a package, a top-level class. Inner classes, which became available with Java 1.1, come in four flavors: Static member classesMember classesLocal classesAnonymous classes. Java class file. 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