The intern() function in Java's String class helps reduce memory consumption by eliminating duplicate string objects, storing intern strings in the JVM heap memory. Earlier, intern strings were in the Perm Generation, but since Java 7, they reside in the Heap region. A practical experiment confirmed this memory behavior.
