Immutability of String objects
As you know, Strings are objects in Java code. These objects, however, are immutable. That is, their value, once assigned, can never be changed. For instance:
String msg = "Hello";
msg += " World";
Here the original String "Hello" is not changed. Instead, a new String is created with the value "Hello World" and assigned to the variable