What is the use of the intern() method?
A. It returns the existing string from memory
B. It creates a new string in the database
C. It modifies the existing string in the database
D. None of the above
Answer:A
What is the use of the intern() method?
A. It returns the existing string from memory B. It creates a new string in the database C. It modifies the existing string in the database D. None of the above
Explanation: The intern() method is used to return the existing strings from the database. In other words, the intern() method returns a reference of the string. For example, if the string constant pool already has a string object with the same value, the intern() method will return a reference of the string from the pool.