Home > Java > Operators > Operator Precedence > Introduction
Introduction

Introduction to Operator Precedence

When Java language  is evaluating an expression, a precedence is chosen for the order of evaluation. For example, the statement:


a = (b+c)*d;


would first perform the operation inside of the parenthesis, the addition of b and c then multiply that result with d, then assign the result to a. The following list shows the precedence of Java operators from highest to lowest:


call,member () [] .
negation/increment ! ~ - ++ --
multiply/divide/modulus * / %
addition/subtraction +  -
relational < <=  > >=
shift << >> >>>
equality == !=
bitwise-and &
bitwise-xor ^
bitwise-or |
logical-and &&
logical-or||
conditional ?:
assignment = += -= *= /= %= <<= >>=> >>= &= ^= |=
comma,

Leave a Reply

Fields with * are mandatory.
* Name:
Website:
* Comments:
 
Tags allowed: <strong> <i> <u>
* Code:
 
 
Submit   Cancel