Programmers frequently make errors regarding the precedence of operators because of the unintuitively - low precedence levels of &
, |
, ^
, <<
, and >>
. Avoid mistakes regarding precedence through the suitable use of parentheses, which also improves code readability. The precedence of operations by the order of the subclauses are defined in the Java Tutorials [Tutorials 2008].
Although it advises against depending on parentheses for specifying evaluation order, EXP05-J. Do not write more than once to the same variable within an expression applies only to expressions that contain side effects.
...
Mistakes regarding precedence guidelines can cause an expression to be evaluated in an unintended way. This , which can lead to unexpected and abnormal program behavior.
...