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

后端 未结 5 1958
野性不改
野性不改 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:24

    The javadoc of getBoolean clearly state that it searches the System Properties. The value that you pass to it is the name of the system property, not a "true" or "false" string.

    E.g., `var b = Boolean.getBoolean("some.property");

提交回复
热议问题