Documentation for the constructor new Boolean(boolean value)
in Java states:
Note: It is rarely appropriate to use this constructor. Unle
Usually, you will want to use valueOf(boolean)
or even the Boolean.TRUE
/ Boolean.FALSE
constants directly.
But think of a scenario where you want to use a private Boolean
variable as a monitor for synchronizing threads. There you will need to make sure you use your own instance and have full control of it.