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