title: Why is this Java operator precedence being ignored here?
body: <p>The following code prints out "3", not "4" as you might expect.</p>
  
  <pre><code>public class Foo2 {
      public static void main(String[] args) {
          int a=1, b=2;             
          a = b + a++;
          System.out.println(a);
      } 
  }
  </code></pre>
  
  <p>I understand how.  The postfix increment happens after the value of "a" has been loaded.  (See below).</p>
  
  <p>What I don't quite understand is the why.  The operator precedence of postfix ++ is higher than + so shouldn't it execute first?</p>
  
  <pre><code>% javap -c Foo2
  
  Compiled from "Foo2.java"
  public class Foo2 extends java.lang.Object{
  public Foo2();
    Code:
     0:   aload_0
     1:   invokespecial   #1; //Method java/lang/Object."&lt;init&gt;":()V
     4:   return
  
  public static void main(java.lang.String[]);
    Code:
     0:   iconst_1
     1:   istore_1
     2:   iconst_2
     3:   istore_2
     4:   iload_2
     5:   iload_1
     6:   iinc    1, 1
     9:   iadd
     10:  istore_1
     11:  getstatic       #2; //Field java/lang/System.out:Ljava/io/PrintStream;
     14:  iload_1
     15:  invokevirtual   #3; //Method java/io/PrintStream.println:(I)V
     18:  return
  </code></pre>