Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
The boolean data type in Java represents one of two possible values - true or false. It is commonly used for conditions and decision-making in programming.
An if statement is used to make decisions based on certain conditions. It executes a block of code only if the condition evaluates to true.
logical operators: Logical operators such as && (AND), || (OR), and ! (NOT) are used to combine multiple boolean expressions and perform logical operations.
comparison operators: Comparison operators such as == (equal to), != (not equal to), > (greater than), < (less than), etc., are used to compare values and return boolean results.