您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)
next.gif
 (2959 bytes)

Content Index
 
Content Page # 36

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

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg