bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Tutorial
Java•Java Tutorial

Java Boolean Data Types

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java Boolean Data Types?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ isJavaFun = true;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

For this, Java has a boolean data type, which can only take the values true or false :
- YES / NO - ON / OFF - TRUE / FALSE
Very often in programming, you will need a data type that can only have one of two values, like:

Boolean Types

Very often in programming, you will need a data type that can only have one of two values, like:

  • YES / NO
  • ON / OFF
  • TRUE / FALSE

For this, Java has a boolean data type, which can only take the values true or false :

Example

boolean isJavaFun = true;
boolean isFishTasty = false;
System.out.println(isJavaFun);     // Outputs true
System.out.println(isFishTasty);   // Outputs false

Boolean values are mostly used for conditional testing.

You will learn much more about booleans and conditions later in this tutorial.

Previous

Java Numbers

Next

Java Characters