Wednesday, May 23, 2012

Boolean

The boolean datatype can store the value True or False.


Where a boolean has not been assigned a value, by default it's value is false.

The format for declaring a boolean variable is:

   Type identifier;

Where the Type is boolean and the identifier is exists:

   boolean exists;

...and where a value of true has been assigned:

   boolean exists = true;

You can declare a boolean in one statement and assign it a value in another statement:

    boolean exists;
   // other statements...
   exists = true;

No comments:

Post a Comment