Java record-27-String's intern Method
The intern () method of the String class :( the meaning of intern detention) public String intern () returns the canonicalized representation of the String object. A String pool with an initial null value, which is privately maintained by the String class. When the intern method is called, if the pool already contains a String equal to this String Object (determined by the equals (Object) method), the String in the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned. It complies with the following rules: For any two strings s and t, if and only when s. when equals (t) is true, s. intern () = t. intern () is true. All literal value string and string value constant expressions use the intern Method for operations. Return: A string with the same content but must be taken from a pool with a unique string. ,