KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Predict the output of the below Java program snippet:

int c = (3<4)? 3*4:3+4;

Java

Java Operators

ICSE

54 Likes

Answer

12

Working

As 3 is less than 4 so condition of ternary operator is true. Variable c is assigned the value of expression 1 which is 3 * 4 = 12.

Answered By

29 Likes