Java Boolean Data Types
Boolean Types
A boolean data type is declared with the boolean
keyword and 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, which you will learn more about in a later chapter.