Boolean
types
The primitive type boolean
is for values that are either true or false.
Examples of code that might use such
a variable include:
boolean
holdsDriversLicence = true;
if( holdsDriversLicence
)
processCarHire();
else
displayMessage("You
cannot hire a car without a licence!");
Boolean types, as can be seen above,
are very useful for forming part of the conditions for selection and iteration
statements, or storing the results of tests to be referred to later.
Back
to top
.
RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex
University. All rights reserved.
webmaster@globalcampus.com.eg
|