The increment and decrement operators : Increment Decrement Operators « Operators « Java Tutorial






  1. add an integer variable by one.
  2. increment operator: two successive plus signs, ++.
  3. decrement operator: --.
public class MainClass {

  public static void main(String[] argv) {
    int count = 10;
    ++count;      // Add 1 to count
    --count;      // Subtract 1 from count
    
    System.out.println(count);
  }

}
10








3.3.Increment Decrement Operators
3.3.1.Increment and Decrement: Demonstrate ++.
3.3.2.The increment and decrement operators
3.3.3.Using the increment and decrement operators in an expression
3.3.4.The prefix form and the postfix form
3.3.5.Using ++ and -- with floating-point variables