0
int x = 5 ; x = (x++)*2+3+(--x) System.out.println(x); answer is 18
please explain this question.but my answer is coming 19 bcz (--x) should be 4 as it is post decreement
3 Answers
+ 3
x=5*2+3+5
=10+3+5=18
x++ increments the value afterwards, so x becomes 6 from 5 and then --x decreases it and it becomes 5 again
+ 1
thanks
0
.Q3. Give the output of the following snippet:
1) int x=5; Find x = x++ *2+3*x;