Why string objects are immutable in java?
Page 1 of 1
Why string objects are immutable in java?
Because java uses the concept of string literal. Suppose there are 5 reference variables,all referes to one object "sachin".If one reference variable changes the value of the object, it will be affected to all the reference variables. That is why string objects are immutable in java.
Similar topics
» What is the meaning of immutable in terms of String?
» How can we create immutable class in java ?
» Why java uses the concept of string literal?
» Can an unrefrenced objects be refrenced again?
» How many objects will be created in the following code?
» How can we create immutable class in java ?
» Why java uses the concept of string literal?
» Can an unrefrenced objects be refrenced again?
» How many objects will be created in the following code?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum