Java precedence

LevelOperatorDescriptionAssociativity
16[]
.
()
access array element
access object member
parentheses
left to right
15++
--
unary post-increment
unary post-decrement
not associative
14++
--
+
-
!
~
unary pre-increment
unary pre-decrement
unary plus
unary minus
unary logical NOT
unary bitwise NOT
right to left
13()
new
cast
object creation
right to left
12* / %multiplicativeleft to right
11+ -
+
additive
string concatenation
left to right
10<< >>
>>>
shiftleft to right
9< <=
> >=
instanceof
relationalnot associative
8==
!=
equalityleft to right
7&bitwise ANDleft to right
6^bitwise XORleft to right
5|bitwise ORleft to right
4&&logical ANDleft to right
3||logical ORleft to right
2?:ternaryright to left
1 =   +=   -=
*=   /=   %=
&=   ^=   |=
<<=  >>= >>>=
assignmentright to left

Resource: https://introcs.cs.princeton.edu/java/11precedence/

Comments

Popular posts from this blog

Lab Network 2024

Step to publish your static html web page to GitHub

Tutorial OOP(reversion java)