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