What is ternary operator in java how you write it ?
Is the ternary operator written x : y ? z or x ? y : z ?
Answer : Ternary operator use to check conditional expression. It is also called conditional operator or inline if or ternary if.
Syntax of ternary operator is : (a == b) ? c : d . Please see example below: