Output Questions for Class 10 ICSE Computer Applications
Predict the output of the below Java program snippet:
int a = 14, b = 4;
boolean x = (a > b) ? true : false;
Java
Java Operators
34 Likes
Answer
true
Working
As 14 is greater than 4 so condition of ternary operator is true. Variable x is assigned the value of expression 1 which is true.
Answered By
18 Likes