1.

Why Is String Class Immutable?

Answer»

Since Java maintains a string pool where String references are shared THUS changing content of any of the String will also AFFECT the other STRINGS SHARING the same references that’s one REASON why string is immutable.

Since Java maintains a string pool where String references are shared thus changing content of any of the String will also affect the other strings sharing the same references that’s one reason why string is immutable.



Discussion

No Comment Found