K Operator Precedence Chart

Operators are shown in decreasing order of precedence from top to bottom (Fig. K.1).

Fig. K.1 Operator precedence chart.

Operator Description Associativity

++

--

unary postfix increment

unary postfix decrement

right to left

 

++

--

+

-

!

~

( type )

unary prefix increment

unary prefix decrement

unary plus

unary minus

unary logical negation

unary bitwise complement

unary cast

right to left

*

/

%

multiplication

division

remainder

left to right

+

-

addition or string concatenation

subtraction

left to right

<<

>>

>>>

left shift

signed right shift

unsigned right shift

left to right

<

<=

>

>=

instanceof

less than

less than or equal to

greater than

greater than or equal to type comparison ...

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.