![]() |
#1 |
Registered User
Join Date: Mar 2018
Posts: 341
|
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.
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is String a data type in java? | Kunal | Java | 1 | 03-18-2016 10:46 PM |