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 ?
- It is also called a conditional operator.
- It is a replacement of if-else statement.
- The statement describes in one line only.
- 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