Learn Java tutorials in the String class

Source: Internet
Author: User

Learn to program the Java tutorial of the string class published, welcome through the xuebiancheng8.com to visit

The string class in Java class should be the most use of a class, we are inseparable from the string class, always in use, interview often test, for example, ask the String class is not the basic data type. The answer is no, the string class is not a basic data type, but the use of the string class and the base data type is very similar.

Let's look at the use of the string class.

String str= "abc";//defines a string ABC

String str1= new String ("abc");//also defines a string

if (STR==STR1) {

System.out.println ("true");

}else{

System.out.println ("false");

}

What is the output of the above program?

The answer is false.

= = The address is compared. Here the first ABC is saved in a constant pool. The second ABC is in the heap space, so = = compares the address differently

This compares whether the strings are equal in equals.

For more information, please visit xuebiancheng8.com

The specific URL is

Http://xuebiancheng8.com/play/goodgoodstudy_101_daydayup.html

Learn Java tutorials in the String class

Related Article

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.