Print Boolean Variable

This program prints the value of a boolean variable.

Problem Statement

Write a Java program that declares a boolean variable and prints its value.

Source Code

1 public class PrintBoolean {
2 public static void main(String[] args) {
3 boolean isEduinqBest = true;
4 System.out.println("Is Eduinq the best? " + isEduinqBest);
5 }
6 }

Program Output

Is Eduinq the best? true

Explanation

A boolean variable isEduinqBest is declared with the value true and printed directly, showing how to declare and print boolean values.

Quick Links to Explore