sas*_*ank 1 java nullpointerexception
我在下面的代码行
String name = null;
if (something)
name = someString;
if (name != null && name.equals("XYZ"))
doSomethingWith ("hello");
Run Code Online (Sandbox Code Playgroud)
如果"something"为false,上面的if条件会导致NullPointerException吗?如果不是为什么不呢?
| 归档时间: |
|
| 查看次数: |
208 次 |
| 最近记录: |