+1 vote
in JAVA by
Why are the objects immutable in java?

1 Answer

0 votes
by

Because Java uses the concept of the string literal. Suppose there are five reference variables, all refer to one object "sachin". If one reference variable changes the value of the object, it will be affected by all the reference variables. That is why string objects are immutable in java.

...