- This operator is also known as Conditional operator.
- It is know as ternary because it contains three operands.
- This operator is represented as ? :
- It check a condition and depending upon the condition, particular instruction is executed.
Condition? Block1 : Block2;
- Condition is any relational or logical expression which will check to see which block of statement should be executed.
- Block1 - Statement will be executed if condition is true.
- Block2 - Statement will be executed if condition is false.
Program To show use of Ternary Operator.