I have the following code:
Boolean bool = null;
try
{
if (bool)
{
//DoSomething
}
}
catch (Exception e)
{
Syst
Boolean is the object wrapper class for the primitive boolean. This class, as any class, can indeed be null. For performance and memory reasons it is always best to use the primitive.
The wrapper classes in the Java API serve two primary purposes:
http://en.wikipedia.org/wiki/Primitive_wrapper_class