getBoolean(String str) and valueOf(String str) of Boolean class gives different output

后端 未结 5 1951
野性不改
野性不改 2020-12-29 18:38

I am surprised to know that getBoolean() and valueOf() method returns different results for the same input string.

I have tried to pass the

5条回答
  •  长发绾君心
    2020-12-29 19:12

    I too found this issue recently when using Boolean.getBoolean() . In addition if you want to have a null check you can use Boolean.parseBoolean which will return false in case of nulls

提交回复
热议问题