Operators

Java Operator Precedence Table

Rows closest to top of table have higher precedence.
Operators in the same row have same precedence.

OperatorTypeAssociativity
( )
.
Parentheses
Member selection
e.g.,   canvas.getWidth()/2
Left to Right

++
--
unary increment
unary decrement
e.g.,   pressCnt++;
 

-
!
Unary minus
Unary logical negation
e.g.,   -50.25
! rich
 
*
/
%
Multiplication
Division
Modulus
Left to right
+
-
Addition
Subtraction
Left to right
<
<=
>
>=
Relational less than
Relational less than or equal
Relational greater than
Relational greater than or equal
Left to right
==
!=
Relational is equal to
Relational is not equal to
Left to right
&& Logical AND

Left to right
|| Logical OR Left to right
=
+=
-=
*=
/=
%=
Assignment
Addition assignment
Subtraction assignment
Multiplication assignment
Division assignment
Modulus assignment