Level | Operator | Description | Associativity |
---|---|---|---|
1 | = += -= *= /= %= | Assignment Addition assignment Subtraction assignment Multiplication assignment Division assignment Modulus assignment | Right |
2 | ? : | Ternary conditional | Right |
3 | || | Logical OR | Left |
4 | && | Logical AND | Left |
5 | | | Bitwise inclusive OR | Left |
6 | ^ | Bitwise exclusive OR | Left |
7 | & | Bitwise AND | Left |
8 | == != | Relational is equal to Relational is not equal to | Left |
9 | < <= > >= instanceof | Relational less than Relational less than or equal Relational greater than Relational greater than or equal Type comparison (objects only) | Left |
10 | << >> >>> | Bitwise left shift Bitwise right shift with sign extension Bitwise right shift with zero extension | Left |
11 | + - | Addition Subtraction | Left |
12 | * / % | Multiplication Division Modulus | Left |
13 | ++ -- + - ! ~ ( type ) | Unary pre-increment Unary pre-decrement Unary plus Unary minus Unary logical negation Unary bitwise complement Unary type cast | Right |
14 | ++ -- | Unary post-increment Unary post-decrement | Right |
15 | () [] · | Parentheses Array subscript Member selection | Left |
Tips and good resources for all.. Oracle, Big data, Hadoop, Unix, Linux
Wednesday, October 14, 2015
Operator Precedence in Java.
Java has well-defined rules for execution order in which the operators in an expression are evaluated when the expression has several operators. Below are the execution orders i.e. precedence in Java Coding.