intern() is an interesting function in java.lang.String object. intern() function eliminates duplicate string objects from the application and has the potential to reduce the overall memory consumption of your application.
To understand how the string intern() function works you may refer to this interesting blog. Intern strings are stored in a string pool in the JVM memory. JVM Memory has the following regions: