Write a Java program to print post Increment operation ?

Write a Java program to print post Increment operation


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

Output:

The PostIncrement value is 10




Using commandLine arguments

class Main
{
    public static void main(String args[])
    {
        int x;
        x=Integer.parseInt(args[0]);
        System.out.println("The PostIncrement value is "+(x++));
    }
}
                                            

Output:

The PostIncrement value is 10




Using Scanner class

import java.util.*;
class Main
{
    public static void main(String args[])
    {
        int x;
        Scanner s=new Scanner(System.in);
        System.out.println("Enter x value ");
        x=s.nextInt();
        System.out.println("The PostIncrement value is "+(x++));
}
}
                                            

Output:

Enter x value 10
The PostIncrement value is 10







More Programs


3 . PostIncrement Program
4 . PreDecrement Program
5 . PostDecrement Program
6 . Addition Program
7 . Substraction Program
8 . Multiplication Program
9 . Division Program
10 . Modular Division Program
11 . Swaping Of Two Numbers With Using Third Variable
12 . Swaping Of Two Numbers Without Using Third Variable
13 . Relation Of Two Numbers Program using > < <= >= !=