Primitive TypesTopBooleans - true and false

Booleans - true and false

The boolean data type represents the values true and false. Variables of type boolean are very useful for remembering whether something succeeded or not.

If we declare a variable

   boolean carryingBall;

then we can revise the onMousePress and onMouseRelease methods to use that boolean variable. Click on EvenBetterBasketBall for an improved version of the program using the boolean variable.


Primitive TypesTopBooleans - true and false