0

Can you explain why this outputs 18 instead of 19.

int a=8; a+ = ++a; System.out.print(++a);

9th Aug 2020, 2:51 PM
kannan
kannan - avatar
2 Réponses
+ 6
a=a+(++a) a=8+9=17 And when a is printed it is incremented again ,so 18
9th Aug 2020, 3:48 PM
Abhay
Abhay - avatar