KnowledgeBoat Logo
|

Computer Applications

Read the following text and choose the correct answer:

Ternary operator is the only conditional operator that takes three operands. It is a one liner replacement of if-else statement.

Which of the following statements is not true for a ternary operator ?

  1. It is also called a conditional operator.
  2. It is a replacement of if-else statement.
  3. The statement describes in one line only.
  4. It makes the program lengthy, if applied in Java programming.

Java Operators

3 Likes

Answer

It makes the program lengthy, if applied in Java programming.

Reason — The ternary operator is used to shorten the code by replacing an if-else statement in just one line. It actually helps to make the program shorter and more readable, not lengthy.

Answered By

2 Likes


Related Questions