+ 2

What is meant by "Strings are not mutable." I cannot understand it inspite of it we can change the value of string through out ?

1st Mar 2017, 8:24 AM
Preet Patel
Preet Patel - avatar
2 odpowiedzi
+ 7
you do not actually change the content of the string, but rather create a new one in java for instance, the old string will remain in the memory until the garbage collector will clear it
1st Mar 2017, 8:42 AM
Burey
Burey - avatar
+ 5
once if you create a string object you cannot modify that string but only thing you can do is you can refer the ref of string object to another string object
1st Mar 2017, 9:47 AM
Bharath yadav
Bharath yadav - avatar