Why string class is immutable in java

Give me correct answer with real time example it's very Argent to me

Your Answer

String is immutable because the it increases the security from hacking like not allowing to change the sensitive data like changing username, password. It is also useful to perform multi threading and we don't need to synchronise. It is also used for string pooling.

Core Java

Didn't get the answer.
Contact people of Talent-Core Java directly by clicking here