KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Predict the output of the below Java program snippet:

int a = 18; int b = 12;  
boolean t = (a > 20 && b < 15)? true : false;

Java

Java Operators

ICSE

32 Likes

Answer

false

Working

The condition a > 20 is false as value of a is 18. So the logical AND operator — && returns false. Variable t is assigned the value of expression 2 which is false.

Answered By

18 Likes