50% found this document useful (2 votes)
126 views

Java Precedence Table

The document outlines the operator precedence table for Java. It lists various operators from highest to lowest precedence, including parentheses, array subscript, unary operators, multiplication, addition, relational operators, bitwise operators, logical operators, ternary conditional, and assignment operators. The table also notes that operators with higher precedence levels are evaluated first, and precedence moves from left to right or right to left depending on the operator.

Uploaded by

milly
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
126 views

Java Precedence Table

The document outlines the operator precedence table for Java. It lists various operators from highest to lowest precedence, including parentheses, array subscript, unary operators, multiplication, addition, relational operators, bitwise operators, logical operators, ternary conditional, and assignment operators. The table also notes that operators with higher precedence levels are evaluated first, and precedence moves from left to right or right to left depending on the operator.

Uploaded by

milly
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like