javacodex.com
Java Examples
Java Examples
memu home questions

Post Increment

This java program example demonstrates the use of the unary operator post increment.

Source: (PostIncrement.java)

public class PostIncrement {
   public static void main(String[] args) {
      int x = 5;
      System.out.println("x = " + x );
      System.out.println("x = " + x++ );
      System.out.println("x = " + x );
   }
}
 

Output:

# java PostIncrement 
x = 5
x = 5
x = 6

Contact: javacodex@yahoo.com