String object is immutable. Explain.- This means, once you have created String object and assigned a value, you can't change the value of the object.
- If you try to change the value, a new object is created while the previous one is still there in the memory.
- The string object once created the data or state can't be changed but a new string object is created.
- The string objects in Java are immutable as it uses the concept of string literal.
- If one reference variable changes the value of the object, it will be affected to all the reference variables.