Computer Science, asked by estherroyin, 1 year ago

Can any one help me with java increment and decrement operators and their execution( change).please help


nancyyy: I can
estherroyin: Please
nancyyy: Please wait for 10 mins
nancyyy: i will come back soon
estherroyin: Why
estherroyin: Okay
nancyyy: I am sooo sorry
nancyyy: I just forgot about it..so i got late

Answers

Answered by Riyuuuuu
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!!!!!

estherroyin: Hello but I have a doubt
Riyuuuuu: Yes plz tell if i know it I will clearly it surely
estherroyin: If int y= 10
estherroyin: Then find
Riyuuuuu: Plz can u ask in inbox
estherroyin: Z = (++y* (y++ + 5))
Riyuuuuu: Z=(11*(11+5)) ---->(11*(16)) ------>176
estherroyin: But how
Riyuuuuu: come in inbox
Answered by nancyyy
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:-)
Similar questions