0
Need Help
I don't understand how the results can be 33 when my code is like this? Please explain me public class Program { public static void main(String[] args) { int a = 2, b = 3; if (a++ > b && ++b > 0){ System.out.println(1); }else { System.out.println(a + "" + b); } } }
4 Antworten
+ 1
Try calling a++ outside if()
Then replace a++ with a in the if like if(a ...
+ 1
When the if statement evaluates a, it then increments a. So the next time when to examine a it has become higher.
+ 1
1. if(a++ > b) is false because (2>3). But after this "a" increments in 1 and equal to 3. That's why 33
0
Thank you all i understand now