Operators
This section is relatively simple, so make some notes simply:
Several points:
1. When the compiler sees a String followed by a "+" followed by a non-string, it attempts to convert the non-string into A String.
2. Compare the contents of the object using the Equals () method, provided that the class that corresponds to the object overrides the Equals () method in the object class, and implements a comparison of the objects ' contents. Most classes in the Java class Library override the Equals () method, so they compare the contents of the object, not the reference.
3, you can ' t use a non-boolean as if it were a Boolean is a logical expression as you can in C and C + +.
4, once the value of the logical expression can be determined to be true or false, then the rest of the logical expression is not executed, we call the "short circuit principle."
5. When you convert a float or double value to an integer value, the number is truncated. If you are rounding to an integer value, you can use the round () method of the math class in the Lang package.
6. Do mathematical operations or shift operations on native data types smaller than the shape of the shape, and their values are automatically promoted to shaping before the operation is performed. Generally, the largest data type in an expression is the type of the result.
7. In addition to the Boolean type, two-way conversions can be made between any two native data types.
8, for floating-point numbers, there is no special designation (such as suffix f), the compiler will treat it as a double value.
Tij English original book reading tour--chapter three:operators