KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Predict the output:

int a=6,b=5;
a += a++ % b++ *a + b++* --b;

Java

Java Operators

ICSE

80 Likes

Answer

a = 49

Working

   a += a++ % b++ *a + b++* --b  
=> a = a + (a++ % b++ *a + b++* --b)
=> a = 6 + (6 % 5 * 7 + 6 * 6)  
// % and * will be applied first due to higher precedence
=> a = 6 + (7 + 36)
=> a = 49

Answered By

41 Likes