HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

Java Booleans

In programming, we will need a data type that can only have one of two values, like:

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

Java has a boolean data type, which can store true or false values.

Example
                
 int x = 10;
int y = 9;
 System.out.println(x > y); // returns true, because 10 is higher than 9