Computer Science, asked by sumitboro1085, 1 year ago

What is the use of ternary operator in java

Answers

Answered by munagalasunilsai143
1

It is an conditional operator in which it takes three operands and it is an one line replacement for if-then-else statement

Answered by Anonymous
0

It isn't a conditional operator in one line

This makes it to use easier instead of increasing the length of ur program by writing in if else or else if else or for loops

Java ternary operator is the only conditional operator that takes three operands. Java ternary operator is a one liner replacement for if-then-else statement and used a lot in java programming. We can use ternary operator to replace switch also

The ternary operator is an operator that takes three arguments. The first argument is a comparison argument, the second is the result upon a true comparison, and the third is the result upon a false comparison. If it helps you can think of the operator as shortened way of writing an if-else statement.

Hope it helped...

Please mark brainliest

Similar questions