Q:

Increment operator ++

Possible Duplicate:
post increment operator java
What is x after “x = x++”? 

Can somebody explain me the result of each one of the following small programs? :
public static void main(String[] args) {
    int a = 10;
    a = a++;
    System.out.println(a);
}

The result is: 10 
Why not 11 since a should have been increased after the assignment? Is that the fact that it comes to different variables left and right of the opeartor = ?
The next one:
public static void main(String[] args) {
    int a = 10;
    a = ++a;
    System.out.println(a);
}

The result is: 11
Comprehensible, but the compiler presents the warning: "The assignment to variable a has no effect". The result dissents though.
Update:
I do not modify my original question but I add this comment to clarify that now I catch the meaning of the warning. That is, even without the assignment (by a plain statement ++a) the result would be the same (11).  

A:

The value of a++ is a. ++ has higher precedence than =. So:

The value of a is taken.
a is incremented.
The value as at (1) is stored into a.

So the value of a doesn't change.
You can figure out yourself what happens in the second case.

