<qhelp>

<overview>

Some expressions always evaluate to the same result, no matter what their subexpressions are:

- `x * 0` always evaluates to `0`.
- `x % 1` always evaluates to `0`.
- `x & 0` always evaluates to `0`.
- `x || true` always evaluates to `true`.
- `x && false` always evaluates to `false`.

Whenever `x` is not constant, such an expression is often a mistake.

</overview> <recommendation>

If the expression is supposed to evaluate to the same result every time it is executed, consider replacing the entire expression with its result.

</recommendation> <example>

The following method tries to determine whether `x` is even by checking whether `x % 1 == 0`.

However, `x % 1 == 0` is always true when `x` is an integer. The correct check is `x % 2 == 0`.

</example> <references>

- The Java Language Specification: Multiplication operator *, Remainder operator %, Bitwise AND operator &, Conditional-and operator && and Conditional-or operator ||.
</references> </qhelp>