Priority of the unary operations
<p>Here is an example that outputs <code>6</code>:</p>

<pre><code>public static void main(String[] args) {
    int i = 1;
    m(++i);
}

static void m(int i) {
    i = ++i + i++; 
    System.out.println(i);
}
</code></pre>

<p>We get <code>6</code> because in the <code>m(int i)</code> method at first <code>3</code> and <code>3</code> are summarized, then <code>i</code> becomes <code>4</code> (due to the <code>i++</code>), but after that <code>i</code> from the left part takes the summarized <code>6</code> value. </p>

<p>But if the method is changed to the following, we get <code>7</code>:</p>

<pre><code>static void m(int i) {
    i = ++i + ++i; 
    System.out.println(i);
}
</code></pre>

<p>But I expected to see <code>7</code> in both cases (I've been guided by the fact that unary operations, in this case incrementing, have a higher priority than binary operations). Could someone please provide an explanation (or a reference to an explanation) of the ignored <code>i++</code> in the first example?</p>
