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 expression "number % 2 == 0" checks if a number is divisible by 2 without having any remainder. If there is no remainder (i.e., equal to zero), it evaluates to true; otherwise, it evaluates to false.
Related terms
Expression: A combination of variables, operators, and values that evaluates to a single value. In this case, "number % 2 == 0" is an example of an expression used within the "isEven" method.
Comparison Operator: Symbols (e.g., ==, <, >) used for comparing values and producing boolean results (true or false).