String 1.What is the meaning of Immutable in the context of String class in Java? An Immutable object cannot be modified or changed in Java. String is an Immutable class in Java. Once a String object is created, it cannot be changed. When we assign the String to a new value, a new object is created. 2.Why a String object is considered immutable in java? Java language uses String for a variety of purposes. For this it has marked String Immutable. There is a concept of String literal in Java. Let say there are 2 String variables A and B that reference to a String object “TestData”. All these variables refer to same String literal. If one reference variable A changes the value of the String literal from “TestData” to “RealData”, then it will affect the other variable as well. Due to which String is considered Immutable. In this case, if one variable A changes the value to “RealData”, then a new String literal with “RealData” is created and A will point to new String li...
Top 1000+ Interview Question Java JSP Spring Hibernate java collection multithreading java string serialization and desensitization final keyword in java package java design patterns maven git repository cloud computation UNIX shell interview question