How do the post increment (i++) and pre increment (++i) operators work in Java?
Does this help? The main point is that ++a increments the value and immediately returns it. a++ also increments the value (in the background) but returns unchanged value of the variable – what looks like it is executed later.