0% found this document useful (0 votes)
48 views2 pages

Java Operator Precedence Table

The document summarizes Java operator precedence and associativity. It lists operators grouped by precedence from highest to lowest. For each operator, it provides the operator symbol, a description, and whether the associativity is left-to-right or right-to-left. The table shows that operators with higher precedence are evaluated before those with lower precedence and the associativity determines whether multiple operators with the same precedence are evaluated left-to-right or right-to-left.

Uploaded by

Akash Tuti
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Java Operator Precedence Table

The document summarizes Java operator precedence and associativity. It lists operators grouped by precedence from highest to lowest. For each operator, it provides the operator symbol, a description, and whether the associativity is left-to-right or right-to-left. The table shows that operators with higher precedence are evaluated before those with lower precedence and the associativity determines whether multiple operators with the same precedence are evaluated left-to-right or right-to-left.

Uploaded by

Akash Tuti
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

APPENDIX

Operator Precedence and


C Associativity

This table shows the precedence and associativity of all the Java operators. The table is
divided into groups, and each operator in a group has the same precedence. The groups
of operators are arranged from the highest precedence at the top of the table to the lowest
precedence at the bottom of the table. For example, the first group of operators shown is:
. [] () ++ --

This group of operators has the highest precedence of all the operators; and each of these
operators has the same precedence.

Operator Description Associativity


. membership left-to-right
[] array subscript left-to-right
() method argument list left-to-right
++ postfix increment left-to-right
-- postfix decrement left-to-right
++ prefix increment right-to-left
-- prefix decrement right-to-left
+ unary plus right-to-left
- unary minus right-to-left
~ bitwise complement right-to-left
! logical NOT right-to-left
new object creation right-to-left
(type) cast right-to-left
* multiplication left-to-right
/ division left-to-right
% remainder left-to-right
+ addition left-to-right
+ string concatenation left-to-right
- subtraction left-to-right

C-1
C-2 Appendix C Operator Precedence and Associativity

Operator Description Associativity


<< left shift left-to-right
>> signed right shift left-to-right
>>> unsigned right shift left-to-right
< less than left-to-right
> greater than left-to-right
<= less than or equal to left-to-right
>= greater than or equal to left-to-right
instanceof type comparison left-to-right
== equal to left-to-right
!= not equal to left-to-right
& bitwise AND left-to-right
^ bitwise XOR left-to-right
| bitwise OR left-to-right
&& logical AND left-to-right
|| logical OR left-to-right
?: conditional right-to-left
= assignment right-to-left
+= combined assignment right-to-left
-= combined assignment right-to-left
*= combined assignment right-to-left
/= combined assignment right-to-left
<<= combined assignment right-to-left
>>= combined assignment right-to-left
>>>= combined assignment right-to-left
&= combined assignment right-to-left
^= combined assignment right-to-left
|= combined assignment right-to-left

You might also like