Operator Precedence in Java
Operator Precedence in Java
http://bmanolov.free.fr/javaoperators.php?media=print&
NOTE: Use explicit parentheses when there is even the possibility of confusion. The operators in Java, shown in order of precedence - from highest to lowest Priority Operators
[ ]
Operation array index method call member access pre- or postfix increment pre- or postfix decrement unary plus, minus bitwise NOT boolean (logical) NOT type cast object creation multiplication, division, remainder addition, substraction
Associativity
() . ++ -+ -
left
~ ! (type) new
right
3 4
* / % + + <<
left left
string concatenation signed bit shift left signed bit shift right unsigned bit shift right less than, less than or equal to greater than, greater than or equal to reference test equal to left not equal to bitwise AND left boolean (logical) AND bitwise XOR left boolean (logical) XOR bitwise OR left left left
7
!= &
8
& ^
9
^
10
1 of 2
1/12/2014 3:03 PM
http://bmanolov.free.fr/javaoperators.php?media=print&
boolean (logical) OR boolean (logical) AND boolean (logical) OR conditional assignment left left right
11 12 13
&& || ? : = *= /= += -= %=
14
<<= >>= >>>=
right
&= ^= |=
2 of 2
1/12/2014 3:03 PM