Java Operator Precedence Table
Precedence Operator Type Associativity
() Parentheses
15 [] Array Subscript Left to Right
· Member selection
++ Unary post-increment
14 -- Right to left
Unary post-decrement
++ Unary pre-increment
-- Unary pre-decrement
+ Unary plus
13 - Unary minus Right to left
! Unary logical negation
~ Unary bitwise complement
( type ) Unary type cast
* Multiplication
12 / Division Left to right
% Modulus
+ Addition
11 - Left to right
Subtraction
<< Bitwise left shift
10 >> Bitwise right shift with sign extension Left to right
>>> Bitwise right shift with zero extension
< Relational less than
<= Relational less than or equal
9 > Relational greater than Left to right
>= Relational greater than or equal
instanceof Type comparison (objects only)
== Relational is equal to
8 != Left to right
Relational is not equal to
7 & Bitwise AND Left to right
6 ^ Bitwise exclusive OR Left to right
5 | Bitwise inclusive OR Left to right
4 && Logical AND Left to right
3 || Logical OR Left to right
2 &: Ternary conditional Right to left
= Assignment
+= Addition assignment
-= Subtraction assignment
1 *= Right to left
Multiplication assignment
/= Division assignment
%= Modulus assignment
Larger number means higher precedence