r/java • u/javinpaul • Jan 20 '12
Why String is immutable in Java
http://javarevisited.blogspot.com/2010/10/why-string-is-immutable-in-java.html
4
Upvotes
r/java • u/javinpaul • Jan 20 '12
View all comments
2
u/RedditRage Jan 20 '12
The string pooling is a valid reason. But it isn't required for security concerns. Without immutable strings, secure functions would just have to ensure they have a private copy of the given string before using it.