JaVa
   

The boolean Data Type

A variable of type boolean can contain one of only two values, true or false. These values are also generally known as 1 and 0, with 1 representing true and 0 representing false. However, in Java the value of a boolean type variable is either true or false only; they are not numeric and therefore cannot be assigned from numeric values. The default value for a boolean type variable is false. The keywords true and false can be used to assign values to boolean type variables. For example:

boolean tutorialIsOnFire = false; // hopefully boolean thisBookIsGreat = true; // hopefully you agree


JaVa
   
Comments