Saturday, March 24, 2018

Post-Increment & Pre-Increment using in Java

/* Example of Post-Increment& Pre-Increment */
package Incremental;
public class Incremental
{
    public static void main(String[] args)
    {
        int counter = 0;
        prln("Counter is : " +counter);
        prln("\n++Counter is : "+ ++counter);
        prln("\nCounter is : "+counter);
        counter = 0;
        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