# opr-java - Java operator precedence reference table # Steve Kinzler, kinzler@cs.indiana.edu, Mar 98 # http://www.cs.indiana.edu/~kinzler/home.html#refer Prec | Operator | Operand Type(s) | Assoc | Operation Performed -----+------------+-----------------+-------+--------------------------------- 1 | ++ | arithmetic | R | pre-or-post increment (unary) | -- | arithmetic | R | pre-or-post decrement (unary) | + - | arithmetic | R | unary plus, unary minus | ~ | integral | R | bitwise complement (unary) | ! | boolean | R | logical complement (unary) | (type) | any | R | cast 2 | * / % | arithmetic | L | multiplication, division, modulo 3 | + - | arithmetic | L | addition, subtraction | + | String | L | string concatenation 4 | << | integral | L | left shift | >> | integral | L | right shift with sign extension | >>> | integral | L | right shift with zero extension 5 | < <= | arithmetic | L | less than, less than or equal | > >= | arithmetic | L | greater than, greater than or = | instanceof | object,type | L | type comparison 6 | == | primitive | L | have identical values | != | primitive | L | have different values | == | object | L | refer to same object | != | object | L | refer to different objects 7 | & | integral | L | bitwise AND | & | boolean | L | boolean AND 8 | ^ | integral | L | bitwise XOR | ^ | boolean | L | boolean XOR 9 | | | integral | L | bitwise OR | | | boolean | L | boolean OR 10 | && | boolean | L | conditional AND 11 | || | boolean | L | conditional OR 12 | ?: | boolean,any,any | R | conditional (ternary) operator 13 | = | variable,any | R | assignment | *= /= %= | variable,any | R | assignment with operation | += -= +-----------------+ | <<= >>= >>>= &= ^= |=