Computer Applications
Give the output of the snippet:
int a=10,b=12;
if(a>=10)
a++;
else
++b;
System.out.println(a + "and" +b);
Java
Java Conditional Stmts
40 Likes
Answer
11and12
Working
As a is 10, the condition if(a>=10) tests true, a++ is executed incrementing the value of a to 11. System.out.println(a + "and" +b); prints 11and12
Answered By
18 Likes