Increment and Decrement Operators in Java


Java provides special operators for incrementing and decrementing variables by one.

Source Code

int i = 1;
i++;    // i is now 2 (increment)
i--;    // i is now 1 (decrement)

Use ++ and — for concise code when incrementing or decrementing variables.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments