0 votes
in JAVA by
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

1 Answer

0 votes
by

(a) It returns the existing string from the memory

Reason: 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.

...