Java is equipped with the primitive data type boolean that allows us to deal with expressions that denote truth values (i.e., expressions whose value can be either true or false).
We recall first the basic notions of boolean algebra.
Domain | truth values true and false | |
Operators | and | conjunction: a and b is true both a and b are true |
or | disjunction: a or b is true a is true or b is true (or both are) | |
not | negation: not a is true a is false |
Example: