Quantcast
Channel: JavaPins - Stories tagged with immutable
Viewing all articles
Browse latest Browse all 8

Why is String immutable or final in Java? | I'd rather be coding

$
0
0
There could be many possible answers to this question, and only the original developer of the String class can provide the real answer. Below are some possible reasons that make sense: 1) StringPool would not be possible at all without strings being immutable, because if a String object/literal, say “Text”, has been referenced by many other reference variables and it changes value, others wi...
Pin it

Viewing all articles
Browse latest Browse all 8