null = userId与userId = null
http://zhidao.baidu.com/question/130229186.html
如果你不小心写成了
userId = null
报错的时候一般不会报这里,因为赋值又没有错。
但是要是写成了
null = userId
报错的时候立即定位到这
还有一种情况,比如a是一个String变量,要比较a是否等于"hello"就要这样写:
"hello".equals(a),不要a.equals("hello"),后面一种容易空指针异常,前面没有