Blogger

Delete comment from: Javarevisited

titu said...

sorry can you please add more to following, I couldn't understand it :(


In case, if String is not immutable, this would lead serious security threat , I mean some one can access to any file for which he has authorization, and then can change the file name either deliberately or accidentally and gain access of those file. Because of immutability, you don't need to worry about those kind of threats. This reason also gel with, Why String is final in Java, by making java.lang.String final, Java designer ensured that no one overrides any behavior of String class.

Apr 27, 2015, 7:35:25 PM


Posted to Why String is Immutable or Final in Java? Explained

Google apps
Main menu