Computer Applications

Find the error in the given statement:

int x = (a => b) ? "a" : "b";

Java Conditional Stmts

10 Likes

Answer

  1. => is an invalid operator. it should be >=
  2. Type of x should be String.
Corrected Statement

String x = (a >= b) ? "a" : "b";

Answered By

6 Likes


Related Questions