Saturday, 9 December 2017

String object is immutable ,how?

String object is immutable ,how?

We create an object of String and initialize a value to it.
We create more than one reference variable of the same object and trying to assign a new value to it.
if we assign a value to any reference variable then value will be changed of all reference variables.
So java did not gave a permission to implement String Object in this way.


2 comments:

What is mutable and immutable for string in java?

Immutable ------------ In java , immutable means , if we assign any value to string , means after creating an object that we can not re-assi...