/* 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);
}
}
0 comments:
Post a Comment