Plz explain this JAVA code. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Plz explain this JAVA code.

Explain this code: 👇👇👇 int x = 1; x += x++; System.out.print(x);

22nd Apr 2021, 1:07 PM
Jawad Ibrahim Shopnil
Jawad Ibrahim Shopnil - avatar
2 Respuestas
+ 7
Jawad Shopnil int x = 1; x += x++; x = x + x++; x = 1 + 1; x = 2;
22nd Apr 2021, 1:11 PM
A͢J
A͢J - avatar
+ 3
Remember x++ first uses the value then increment the value
22nd Apr 2021, 1:17 PM
Atul [Inactive]