top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why in Java design String class is made as a immutable class?

+2 votes
322 views
Why in Java design String class is made as a immutable class?
posted Nov 20, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

String Pool facility without making string immutable is not possible at all because in case of string pool one string object/literal e.g. "XYZ" will be referenced by many reference variables , so if any one of them changes the value others will be automatically gets affected .

answer Nov 25, 2014 by Nikhil Omar
...