java ternary operator or conditional operator
In whole JAVA conditional operator is the only ternary operator.
How To Use It?
It is very simple to use.
First, it checks the condition, if the condition is true then it executes next statement after ? symbol .
If the condition is false then it executes statement after (colon) : the symbol.
Syntax with an example.
example 1.
int a=(10<20) ? 50 : 60;
System.out.println(a);
Output is 50
