The ++ operator adds one: x++; is equivalent to x = x + 1;. The -- operator subtracts one: y--; means y = y - 1;. Both modify the variable directly. These operators only work on variables, not literals.
5++; causes a compilation error because you cannot modify a constant. Apply ++ to a named variable. Increment and decrement are common in loops. for (int i = 0; i < 10; i++) uses i++ to move through values 0 to 9.