Computer Science, asked by oendrila8, 1 year ago

what do you mean by ternary operators ...explain with an example....in java

Answers

Answered by saniya9343
1
The ternary operator is an expression (like price + 20 for example), which means that once executed, it has a value. And that value needs to be further used, for example by assigning it to a variable or returning from a method, or the expression will not compile

The Java ternary operator functions like a simplified Java if statement. The ternary operator consists of a condition that evaluates to either true or false , plus a value that is returned if the condition is true and another value that is returned if the condition is false .

I HOPE IT WILL HELP YOU DEAR
THANKU
Answered by 8473027846
1
The ternary operator is an expression (like price + 20 for example), which means that once executed, it has a value. And that value needs to be further used, for example by assigning it to a variable or returning from a method, or the expression will not compile.
Similar questions