Blogger

Delete comment from: Java67

Anonymous said...

One advantage of making String immutable is for saving memory. When your program grows the number of String instances it creates also grows and if you don't cache String constants you end up with lots and lots of String in your heap space. By caching and sharing String constants JVM reduces lots of memory for real world Java applications.

Jan 1, 2015, 11:40:51 PM


Posted to Why String is Immutable or final in Java - 5 Reasons

Google apps
Main menu