English

Given: String st = (a>= 90)? "Excellent": "Best"; Predict the output, when a = 90. - Computer Applications

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?
Chapter 1.04: Operators in Java - EXERCISES [Page 43]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.04 Operators in Java
EXERCISES | Q I. 3. | Page 43
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×