I found a question on Stack
String literals [ie, Strings
new String("abcd")] in Java are interned – this means that every time you refer to “
String Interning is a method of storing only one copy of each distinct String Value, which must be immutable.
This article goes into more detail on actively using the intern() method to intern strings is useful in some cases.