Give the output of the snippet:
int a=10,b=12; if(a==10&&b<=12) a--; else ++b; System.out.println(a + "and" +b);
48 Likes
9and12
As a is 10 and b is 12 so the condition of if is true. a is decremented by 1, b remains unchanged.
Answered By
23 Likes
Predict the output:
int a=6,b=5; a += a++ % b++ *a + b++* --b;
Rewrite the snippet using Ternary operators:
if(a<b) { c=(a+b); } else { c=(a-b); }
int p = 9; while (p<=15) { p++; if(p== 10) continue; System.out.println(p); }