Code confusion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Code confusion

One of the challenge questions in Java is this. int a=4; int b=1; int c=++a + --b; System.out.print(c>a?1:0); It outputs as zero (0) and I have no idea why. If I do c>a I get false as output and any other variation gives me errors. can someone help explain all that is going on in the System.out.print()? Thank you.

2nd Mar 2017, 2:22 PM
charlie
0 Answers