Begin 2018年1月16日21:25:33

    1.if(username.equals("zxx")) { }
    2.int x = 1;
    return x==1?true:false;

1.不妥之处是当username = null时,会抛出NullPointerException(空指针异常),应该把可能为nullusername放到后面,变成"zxx".equals(username)即可。
2.不妥之处是x == 1本来就是boolean类型,画蛇添足。

参考:下面的代码有什么不妥之处

End 2018年1月16日21:43:38

相关文章:

  • 2021-10-21
  • 2022-01-07
  • 2021-05-25
  • 2021-06-29
  • 2022-12-23
  • 2021-09-23
  • 2021-07-17
  • 2022-02-10
猜你喜欢
  • 2021-10-01
  • 2022-01-06
  • 2022-12-23
  • 2021-07-10
  • 2022-01-07
  • 2021-05-18
  • 2021-08-30
相关资源
相似解决方案