0
How is the output 33 and not 34. Can someone help me understand this?
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 Answers
0
2 > 3 false
2++
rest of if() expresion is ignored, because result is still false // (false && true = false )
0
The reason is: if(false &&... => the rest is not checking during runtime, because from Java's point of view it makes no sense (the result will be false anyway).
0
Thank you very much guys for the clarification. Helped a lot.!!