Given the following:
What is the output?
The post-increment expression x++ evaluates to 1 and leaves x as 2, while the pre-increment expression ++y increments y to 1 before evaluation. Since the compared values are equal, the if branch prints Hello , followed by Log 2:1.
x++
x
++y
y
if
Hello
Log 2:1
Community Discussion