public class Sample {

    public static void main(String[] args) {
        int num1 = 10, num2 = 20;
        num1--;
        System.out.println("now num1: " + num1);
        System.out.println("now num2: " + (num2--));
        System.out.println("now num2: " + (num2--));

    }
}



OUTPUT:
now num1: 9
now num2: 20
now num2: 19

 demo2

public class Sample {

    public static void main(String[] args) {
        int num1 = 10, num2 = 20;
        int num3 = 5, num4 = 7;
        ++num1;
        System.out.println("now num1: " + num1);
        System.out.println("now num2: " + (++num2)); // first the num2 gets incremented
        System.out.println("now num3: " + (num3++));
        num4++;
        System.out.println("now num4: " + (num4));
    }
}



OUTPUT:
now num1: 11
now num2: 21
now num3: 5
now num4: 8