Evaluate java expression,int a =20. when a+ = ++a + --a + a - (10/2) + a++
Answers
Answered by
14
a+ = ++a + --a + a - (10/2) + a++
= 20+ 21 + 19 +20 -5 + a++
= 80 -5 + a++
=75 + 20(++)
=95 .
now, the value of last "a" becomes 21.
Answered by
4
Here the expression is-
a++ + --b when a = 20
Then second step it'll be 10 +-b (here for the post increment a will give previous value then a will increment a's value now the expression is 10 + --b, a=11)
So the final expression would be
10+19 = 29
So, 29 is the answer
Similar questions