The boolean Data Type - Java Language Basics

Java examples for Language Basics:boolean

Introduction

The boolean data type has only two valid values: true and false.

These two values are called boolean literals.

You can use boolean literals as

boolean done; // Declares a boolean variable named done 
done = true;  // Assigns true to done 
  

A boolean variable cannot be cast to any other data type and vice versa.


Related Tutorials