Here is a Java Program to Demonstrate the Increment and Decrement Operators
Output of Above Java Program
a = 2
b = 3
c = 4
d = 1
class IncDec { public static void main(String args[]) { int a = 1; int b = 2; int c; int d; c = ++b; d = a++; c++; System.out.println("a = " + a); System.out.println("b = " + b); System.out.println("c = " + c); System.out.println("d = " + d); } }
Output of Above Java Program
a = 2
b = 3
c = 4
d = 1