Java String intern()The java string intern() method returns the interned string. It returns the canonical representation of string. It can be used to return string from memory, if it is created by new keyword. It creates exact copy of heap string object in string constant pool. SignatureThe signature of intern method is given below: Returnsinterned string Java String intern() method examplefalse true Java String intern() Method Example 2Let's see one more example to understand the string intern concept. true false true false true false Next TopicJava String isEmpty
|