KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Give the output of the program snippet.

int a = 10, b =12;
if(a>=10)
a++; 
else 
++b;
System.out.println(" a = " + a + " and b = " +b);

Java

Java Operators

152 Likes

Answer

a = 11 and b = 12

Working

The condition if(a>=10) is true so a++ increments a to 11. b remains the same.

Answered By

75 Likes