I know this is a silly example, but I do want to know how it works.
In general, post-increment gives the old value and add 1 to the variable after.
int a = 1;
a = a++;
System.out.println(a);
At line3, it prints out "1". why does a remain the same?
In my understanding, At line2, the right hand side assigns 1 to the variable a.
post-increment "++" add 1 to a. Shouldn't it be 2 instead of 1?