You are applying two increments on i. The initial value was 0 so after two increments (++i and i++ )it will become 2.
Both i++ and ++i are incrementing the value of i by one.
They are similar to
i = i+1;
but the ++i one increments the value of i then uses it, so 0 becomes 1 and printed out, while the i++ first uses the value and then increments the value of i, so the printed value is 1 and then it becomes 2 hence the last digit(the final value of i) is 2.