What is Java Operator Precedence?

Java operator precedence is how Java determines which operator to evaluate first.

In this chart, operator precedence is displayed from highest precedence to lowest precedence.

Priority Operator Operation Order of Evaluation
1 [ ] Array index Left to Right
() Method call
. Member access
2 ++ Prefix or postfix increment Right to Left
-- Prefix or postfix decrement
+ - Unary plus, minus
~ Bitwise NOT
! Boolean (logical) NOT
(type) Type cast
new Object creation
3 * / % Multiplication, division, remainder Left to Right
4 + - Addition, subtraction Left to Right
+ String concatenation
5 << Signed bit shift left to right Left to Right
>> Signed bit shift right to left
>>> Unsigned bit shift right to left
6 < <= Less than, less than or equal to Left to Right
> >= Greater than, greater than or equal to
instanceof Reference test
7 == Equal to Left to Right
!= Not equal to
8 & Bitwise AND Left to Right
& Boolean (logical) AND
9 ^ Bitwise XOR Left to Right
^ Boolean (logical) XOR
10 | Bitwise OR Left to Right
| Boolean (logical) OR
11 && Boolean (logical) AND Left to Right
12 || Boolean (logical) OR Left to Right
13 ? : Conditional Right to Left
14 = Assignment Right to Left
*= /= += -= %=
<<= >>= >>>=
&= ^= |=
Combinated assignment
(operation and assignment)

Notes:



Top 5 Free Networking Tools

Bookmark What is Java Operator Precedence?

Latest Blog Posts


Copyright 2008 Tech-FAQ. All rights reserved.