what do you mean by ternary operators ...explain with an example....in java
Answers
Answered by
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
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
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
Biology,
6 months ago
Math,
6 months ago
Math,
6 months ago
Biology,
1 year ago
Computer Science,
1 year ago