in JAVA by (20.8k points)
What does String intern() method do?

1 Answer

0 votes
by (20.8k points)

When the intern method is invoked, if the pool already contains a string equal to this String object as determined by the equals(Object) method, then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned.

Related questions

0 votes
asked Mar 16, 2021 in JAVA by Robindeniel (20.8k points)
0 votes
asked Jan 24, 2020 in JAVA by rahuljain1 (6.5k points)
0 votes
asked May 3, 2021 in JAVA by Robindeniel (20.8k points)
...