String Literals and the String Pool in Java

In Java, Strings are among the most used classes. Repeated String allocations can put significant pressure on the garbage collector…