Boolean

Edit on Github instead

The Boolean class is a wraps boolean primitives into Boolean objects.

Creating a Boolean object

The constructor for Boolean objects takes one of four values:

A true or false primitive:

Boolean b = new Boolean(false);
b;                                  // Returns false

A variable of a boolean primitive:

Boolean b = true;
Boolean c = new Boolean(b);
b;                                  // Returns true

Another Boolean object:

Boolean b = new Boolean(false);
b;                                  // Returns false
Boolean c = new Boolean(b);
c;                                  // Returns false

Simple assignment:

Boolean b = true;                 // Returns true; b is a Boolean object
boolean c = true;                 // Returns true; c is a boolean primitive

Suggest changes

Related links

URL Topic Source