ICSE Class 10 Computer Applications Question 11 of 43

Conditional Constructs in Java — Question 11

Back to all questions
11
Question

Question 11

Find the error in the given statement:

int x = (a => b) ? "a" : "b";
Answer
  1. => is an invalid operator. it should be >=
  2. Type of x should be String.
Corrected Statement
String x = (a >= b) ? "a" : "b";