You are on page 1of 8
Operator Associativity | Precedence 0 Function call Left-to-Right | Highest 14 Oo Array subscript : Dot (Member of structure) —> _| Arrow (Member of structure) ! Logical NOT Right-to-Left 13 - Qne’s-complement - Unary minus (Negation) ++ Increment -- Decrement & Address-of Tndirection Cast Bizeof Maltiplication Left-to-Right 12 Division Modulus (Remainder) Addition Left-to-Right ii Subtraction Left-shift Left-to-Right id Right-shift Less than Left-to-Right 8 Less than or equal to Greater than Greater than or equal to Equal to Left-to-Right a ! Not equal to & Bitwise AND Left-to-Right 7 = Hitwise XOR Left-to-Right § | Bitwise OR Left-to-Right 5 ak Logical AND Left-to Right 4 ul Logical OR Left-to-Right 3 7: | Conditional Right-to-Left z » += | Assignment operators Right-to-Left 1 +=, etc > Comma Teft-to Right | Lowest 0 Table 5.1: Precedence and Associativity ‘Table Operator’s Precedence in Java First (Highest) Second Third Fourth “Fifth Sixth Seventh = (assignment Operator) Lowest Malik AB int int int int int int int oi uw i i ou >aA0D A 0 7 “ c 3 34; Zt at+ + ++b; --a + --b + C--; at+b + +c + d--; -a + b-- + -c - d++; =Fatb+tctadtertf; int i=1, 7=2,. k=3; int m System. System. system. system. fee a Fon = Koad out.printin("i="+1); out.println("j="+j); out.println("k="+k); out.println("m="+m) ; int i=0; i= it+ - --i + ++i - i--: System.out.println(1); int m Il oC 3 I = int p = --m * --n * n-- * m--; System.out.println(p); public static void main(String[] { int a=1: a = att+ + ++a * --a - a--; System.out.println(a) ;

You might also like