Evaluate the following Java expression, if x=3, y=5, and z=10: ++z + y - y + z + x++
Answers
Answered by
2
Answer:
24
Explanation:
x=3
y=5
z=10
The first way is like if we consider the question as a normal equation then the explanation to it is as follows:
The given expression is like this ++z+y-y+z+x++,
where the z=10 is the value but, ++Z is the pre-increment so the value of Z will be 11 before evaluating the equation.
Even at the end of the equation, we have X++ its post-Increment so it won't affect while evaluating the equation it will be increment after the evaluation.
(++10)+5-5+10+(3++)
11+5-5+10+3
=24
Similar questions