Is there a difference between ++x and x++ in java?
These are known as postfix and prefix operators. Both will add 1 to the variable but there is a difference in the result of the statement.
int x = 0; int y = 0; y = ++x; // result: y=1, x=1 int x = 0; int y = 0; y = x++; // result: y=0, x=1