0% found this document useful (0 votes)
23 views3 pages

Reading Material - Operator Precedence

Reading material

Uploaded by

tabrahul9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Reading Material - Operator Precedence

Reading material

Uploaded by

tabrahul9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Operator Precedence Operator precedence determines the order in which the operators in an expression are evaluated. For eg — intx=3*4-1; In the above example, the value of x will be 11, not 9. This happens because the precedence of * operator is higher than - operator. That is why the expression is evaluated as (3 * 4) - 1 and not 3 * (4-1). Operator Precedence Table Operators Precedence postfix increment and decrement ++ J(--]} prefix increment and decrement, and ++ |[ -- |[+]/-) ~ unary a KO multiplicative DM additive + shift “ec |(5>] (55>) relational < || > }[<=][>=]| instanceof equality ==] (I= bitwise AND. & bitwise exclusive OR “ bitwise inclusive OR | logical AND && logical OR ul ternary 2 assignment (igs eG Associativity of Operators APNA COLLEGE If an expression has two operators with similar precedence, the expression is evaluated according to its associativity (either left to right, or right to left). Operators Precedence Associativity postfix increment and ae left to right jecrement Seorementandunay | CUCIC right ole multiplicative HOE left to right additive HC left to right shift “ex |(>>][>5> left to right relational SEIS left to right instanceof | equality == left to right bitwise AND & left to right bitwise exclusive OR * left to right bitwise inclusive OR L left to right logical AND 8& left to right logical OR 1 left to right ternary 2 right to left assignment right to left Note - These notes are just for a quick glance. We don't have to memorize them all at once. Most of these rules are very logical and we have been following them in a lot of instances already.

You might also like