Download presentation
Presentation is loading. Please wait.
Published byShannon Stanley Modified over 9 years ago
1
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence Operator Meaning Assoc. ===========================================================. member access L -> R [] array index L -> R () method call L -> R ++ post-increment R -> L ++ pre-increment R -> L -- post-decrement R -> L -- pre-decrement R -> L ~ bitwise complement R -> L ! boolean NOT R -> L - unary minus R -> L + unary plus R -> L new object creation R -> L (type) type cast R -> L
2
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Meaning Assoc. =========================================================== * multiplication L -> R / division L -> R % remainder L -> R + addition L -> R - subtraction L -> R + string concatenation L -> R R >> signed bit shift right L -> R >>> unsigned bit shift right L -> R R > greater than L -> R >= greater than or equal to L -> R instanceof type comparison L -> R == equal to L -> R
3
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Meaning Assoc. =========================================================== != not equal to L -> R & bitwise AND L -> R & boolean AND L -> R ^ bitwise exclusive or (XOR) L -> R ^ boolean XOR L -> R | bitwise OR L -> R | boolean OR L -> R && boolean AND (short-circuit) L -> R || boolean OR (short-circuit) L -> R ?: conditional L -> R = assignment R -> L
4
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Meaning Assoc. =========================================================== *= multiplication assignment R -> L /= division assignment R -> L %= remainder assignment R -> L += addition assignment R -> L -= subtraction assignment R -> L L >>= bitwise unsigned right shift assignment R -> L >>>= bitwise right shift assignment R -> L &= bitwise AND assignment R -> L |= bitwise inclusive OR assignment R -> L ^= bitwise exclusive OR assignment R -> L
5
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Usage ===============================. object.member [] arr[index] () (argument_list) ++ value++ ++ ++value -- value-- -- --value ~ ~expr ! !expr - -expr + +expr new new type() (type) (type)expr
6
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Usage =============================== * expr / expr % expr + expr - expr + str << expr >> expr >>> expr < expr <= expr > expr >= expr instanceof obj instanceof type == expr
7
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (continued) Operator Usage =============================== != expr & expr ^ expr | expr && expr || expr ?: expr ? expr : expr = value = expr
8
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Java Operator Precedence (concluded) Operator Usage =============================== *= value *= expr /= value /= expr %= value %= expr += value += expr -= value -= expr <<= value <<= expr >>= value >>= expr >>>= value >>>= expr &= value &= expr |= value |= expr ^= value ^= expr
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.