The pit of the = = symbol in Java

Source: Internet
Author: User

In a technical group to see such an interview topic:

This is the answer of a Java practitioner with 4 years of experience.

What's your answer?

The correct answer is true.

Why?

In fact, when using string A= "a" + "B" +1, the program will create a string buffer pool (string pool), put a into the, when again use stirng b= "AB1", the program first in this String buffer pool to find the same value of the object; Then a, a, object that references the same value.

We can find a lot of data related to string pool.

Related information:

The difference between = = and Equel in Java examples of the concept of the Java String buffer pool (interview questions)

The pit of the = = symbol in Java

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.