Can any one help me with java increment and decrement operators and their execution( change).please help
nancyyy:
I can
Answers
Answered by
1
Yes if it postfix (a++)it means after execution and if it is prefix (++a)it means before execution (increment or decrement)
I hope it will help you!!!!!
I hope it will help you!!!!!
Answered by
0
For eg..Take any variable x
Now if x value is 5 and its x++
Then, value will be stored and execute in its next execution not in present execution and output will remain 5...
If its ++x then value will directly increase because its prefix operator and output will be 6.
Same..in decreasing operator
if its x--
then output will be 5(value is stored at present)
And if its --x
Then value will directly execute and the output will be 4.
Hope this helps you:-)
Now if x value is 5 and its x++
Then, value will be stored and execute in its next execution not in present execution and output will remain 5...
If its ++x then value will directly increase because its prefix operator and output will be 6.
Same..in decreasing operator
if its x--
then output will be 5(value is stored at present)
And if its --x
Then value will directly execute and the output will be 4.
Hope this helps you:-)
Similar questions