Why a++ is not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
26th Feb 2019, 9:29 AM
Yroslav
4 Answers
+ 5
I don't know how much this will help you, Yroslav, but let's go. When you do ++a, the value first increases to 401 and then it's attributed to c. Using a++, the value of 400 is attributed to c first and then increased to 401, so c does not get the increment, only a. If you wrote System.out.print(a) instead, both a++ and ++a would give you the same result.
28th Feb 2019, 12:49 AM
D.R.
D.R. - avatar
+ 4
Daniel Rosa is right. Miss doing Java challenges with you Daniel.
28th Feb 2019, 1:04 AM
Sonic
Sonic - avatar
+ 3
26th Feb 2019, 10:08 AM
Júlia
Júlia - avatar
+ 3
ty
26th Feb 2019, 10:15 AM
Yroslav