I used to write constants on the left.
For example,
"coshaho" .equals (name)
if written as
name.equals ( "coshaho"), when the name is null will complain, even if the business is correct, then the need to write the code for the
name! = Null && name.equals ( "coshaho")
such as
null == name
if the variable is written on the left, accidentally wrote the name = null, no error will compile and run, but the logic error. The null = name that is being given at compile-time constants left to write mandatory You can not compare logic written assignment.
Questions about the project encountered - Constant why the left
Guess you like
Origin www.cnblogs.com/yunliu0603/p/10953902.html
Recommended
Ranking