· It is
mainly for security reasons.
String is used as parameter in network
connection, database url etc. It can be easily attacked if it is
mutable·Immutability of String solves some synchronization issues,
it makes the String thread safe· To
support StringPool facility· To cache the hashcode of String To
support class loading mechanism in
which String is used as arguments. String being mutable results in wrong class
being loaded.
No comments:
Post a Comment