Advertisements
Advertisements
Question
Given: String st = (a>= 90)? "Excellent": "Best";
Predict the output, when a = 90.
Options
Best
Excellent: Best
Best: Excellent
Excellent
MCQ
Solution
Excellent
Explanation:
Since condition (a>= 90) of the ternary operator is true, st is assigned the value of expression 1, i.e., excellent.
shaalaa.com
Is there an error in this question or solution?