About Question enthuware.ocajp.i.v8.2.1417 :
Posted: Sun Jun 21, 2015 12:14 pm
Hi Paul,
I am not sure I understand what you meant in the last sentence of the Explanation:
I guess it should have been:
...but new Boolean(true) == Boolean.parseBoolean("true") is true
I might be wrong so please correct me if so. Thanks
I am not sure I understand what you meant in the last sentence of the Explanation:
can we have new Boolean()? I guess not as we have only two constructors, one that takes a String and one that takes a boolean as parameters.If both are Boolean wrappers, then their references are compared just like in the case of other objects.
Thus, new Boolean("true") == new Boolean("true") is false, but new Boolean() == Boolean.parseBoolean("true") is true.
I guess it should have been:
...but new Boolean(true) == Boolean.parseBoolean("true") is true
I might be wrong so please correct me if so. Thanks