Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show the use of Increment and Decrement Operators

Posted By: Traci Palmer     Category: Java     Views: 70718

A Java Program to show the use of Increment and Decrement Operators.

Code for Program to show the use of Increment and Decrement Operators in Java

publicclass JAVA_003
 {
    publicstaticvoid main(String[] args)
    {
       intvalue=5;

       System.out.println("Initial Value  =  " + value);

       System.out.println("Value after prefix increment =  " + ++value);
       System.out.println("Value after postfix increment =  " + value++);

       System.out.println("Value after after increment operations =  " + value);

       System.out.println("Value after prefix decrement =  " + --value);
       System.out.println("Value after postfix dencrement =  " + value--);

       System.out.println("Value after after decrement operations =  " + value);
    }
 }
  
Share: 



Traci Palmer
Traci Palmer author of Program to show the use of Increment and Decrement Operators is from Chicago, United States.
 
View All Articles

 

Other Interesting Articles in Java:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!