= Only one-sided comparisons can be made. Why? When comparing basic types, it compares actual values. When comparing object types, because the objects in Java are referenced by addresses, so = only one-sided comparison of the address, rather than in-depth investigation.
The equals () method has the same effect as =, but equals () is a method after all. People can override it to change its original functions. For example, after overwriting, The equals () method may become a comparison of object values.
Note that some objects in Java have already overwritten the equals () method, such as string. In this way, when comparing strings, The equals () method compares values.
2. If (STR = NULL | Str. Equals ("")){}
Pay attention to two issues:
(1) determine the null value of the row to be selected
(2) Use equals () instead of = for comparison.
(3) When comparing null strings, note the space in the middle.