How to Use Increment Operator in Java


In this example, we will learn you how to use increment operator in Java.

Source Code

package com.beginner.examples;

public class IncrementOperator {
  public static void main(String[] args) {
    int i = 3;
    ++i; // use increment operator
    System.out.println(i);
  }
}

Output:

4
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments