Saturday, March 24, 2018

Decremental of Java Programming

/* Example of Post-Decrement & Pre-Decrement */
package Decremental;
public class Decremental
{
    public static void main(String[] args)
    {
        int counter = 1;
        prln("Counter is : " +counter);
        prln("\n--Counter is : "+ --counter);
        prln("\nCounter is : "+counter);
        counter = 1;
        prln("\nCounter is : "+counter);
        prln("\nCounter++ is : "+counter--);
        prln("\nCounter is : "+counter);
    }
    static void prln(Object anyObject)
    {
        System.out.println(anyObject);
    }
    static void pr(Object anyObject)
    {
        System.out.print(anyObject);
    }
   
}






Share:

0 comments:

Post a Comment

Blogger templates