Java Quick Guide

 
 
This guide contains useful Java information.







Java boolean type.



Information
A boolean is a logical type that can only have the values true or false. One bit is only used to represent a boolean value. If the bit is 0 the value is false, if the bit is 1 the value is true.

Java boolean.


public class DemoBoolean {

   public static void main (String[] args) {
      boolean check1 = true;
      boolean check2 = false;
      if (check1) {
         System.out.println("check1 is true");
      }
      if (check2) {
         System.out.println("check2 is true");
      }
   }
}


You should see:

check1 is true