Thursday, October 26, 2017

Java Postfix Operators (increment Operators ++ and Decrement Operators --)

Hi All,

Today I'm going to teach how to use Post-fix Operators in Java, There are two postfix operators increment Operators and Decrement Operators .

Increment Operators

Increment Operators symbolize by using ++ and use to increments variable value by one.


Decrement Operators

Decrement Operators symbolize by using -- and use to decrements variable value by one.

Let's see how these operators works in code,



Some confusing thing happens at the first time we use x++ and x-- it will print originally assigned vale and the change the value.

I will explain you what is really happens when we use those operator in upcoming post. For programming purpose I will explain it as follows.

This is not what really happens when we use these operators

think this operation excite form left to right so as soon as x passes excite process will take x value as 100 then it passes ++ then it increment x by 1 so from the next line onward x is 101

think this operation excite form left to right so as soon as y passes excite process will take y value as 10 then it passes -- then it decrements y by 1 so from the next line onward y is 9

Catch you guys on next post bye...!

No comments:

Post a Comment