Im reading a book for learning java fundamentals. In Strings section i have read immutable strings and i get it that strings in java are immutable But then i read the sentence that i wrote in question title,
But immutable strings have one great advantage: the compiler can arrange that strings are shared
How compiler can arrange that strings are shared, what does that really mean? How it is an advantage of immutable strings?
Thanks in advance.