Write a program in java to demonstrate increment and decrement operator?

class IncrementDecrement

{

                public static void main(String arg[])

                {

                                int a=2,b=5;

                                System.out.println(++a+ ++b);

                                System.out.println((--a- --b)+ ++b);

                                System.out.println(a++ +(++b- --a));

                                System.out.println(a+b);

                }

}

Increment & Decrement.PNG

, , , , , , , ,

Leave a Reply