Increment and Decrement Operators in Java


Use ++ and — to increase or decrease a value by one. These can be prefix or postfix operators.

Source Code

int a = 5;
a++;  // Now a is 6
a--;  // Back to 5
System.out.println("a after increment and decrement: " + a);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments