Java String intern() method

Java String intern() method returns canonical representation for the String Object.

syntax:

Return:

It returns a interned String that to be a pool of unique String.

Java String intern() Example 1

Output:

Java String intern() Example 2

output:

Leave a Comment