Java record-27-String's intern Method

Source: Internet
Author: User

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. ,
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.