I am surprised to know that getBoolean()
and valueOf()
method returns different results for the same input string.
I have tried to pass the
Boolean.getBoolean
must be the worst placed method in java. One of the big WTF.
Why wasn't it placed in System
or Properties
or whatever?
So to answer your question - yes, it is a very confusing thing and you can just click on the method in your IDE to see the code or read the javadoc.
Here's the source code:
public static boolean getBoolean(String name) {
boolean result = false;
try {
result = toBoolean(System.getProperty(name));
} catch (IllegalArgumentException e) {
} catch (NullPointerException e) {
}
return result;
}