can anyone please solve this question..
Attachments:
![](https://hi-static.z-dn.net/files/d51/a5257dfe7425e1c7a77019b85c3004c7.jpg)
Answers
Answered by
0
Explanation:
initially a is set to 5 which is incremented and becomes 6
now the first 'System.out.println' prints out '6'
the line 'a-=(a--)-(--a)' can be actually simplified to 'a=a-((a--)-(--a))'
so putting the values, a=6-(6-4)=4
since 'a--' returns the value of a and then decrements it and '--a' first decrements the value of a and then returns it.
it's kinda like this, a is 6 then a-- returns 6 and changes the value of a to 5 and the second --a changes the value of a to 4 and returns it.
Hope you understood it.
Similar questions