0 votes
in JAVA by

Evaluate the following Java expression, if x=3, y=5, and z=10:

++z + y - y + z + x++

i) 24

ii) 23

iii) 20

iv) 25

1 Answer

0 votes
by

i) 24

Reason: In the above expression, ++z means that the value will first increment by 1, then used. Now, evaluate the statement by putting the values of x, y, and z. On calculating the final answer is 24, as shown below.

++z +y -y +z + x++
11 + 5 - 5 + 10 + 3 = 24

Related questions

0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
...