Basic Java Knowledge

Source: Internet
Author: User

1, "+" the order of matching is calculated from left to right, if both sides of the connected content is the basic number type then according to the addition operation, if the content participating in a connection is a string to connect by string. For example:
1 int a = ten; 2 String s = "123" + A + 5;
Then the value of the string s after the connection is "123105", the procedure is to concatenate the string "123" and the value of variable a, generate the string "12310", and then use the string and the number 5 to connect to produce the final result. And the following code:
1 int a = ten; 2 String s = a + 5 + "123";
Then the value of the string s after the connection is "15123", the process of calculation is to first calculate a and the number 5, because all are numeric type is the addition operation or numeric value 15, and then use the numeric value 15 and the string "123" to connect to obtain the final result. 2, Equals method The function of this method is to determine whether the contents of two string objects are the same. Returns true if it is the same, otherwise false. For example:
string s = "abc"new String ("abc"); Boolean b = s.equals (S1);
Returns True. The comparison with "= =" is whether the two objects store the same address in memory. For example, in the above code, if you decide:
Boolean b = (s = = S1);
The value of the variable B is false, because the address of the S object is the address of "ABC", and S1 uses the New keyword to request a different memory, so the memory address is not the same as the address of S "ABC", so the obtained value is false.

Basic Java Knowledge

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.