Back to Java Questions Index

Cosmic Q&A

What is ternary operator in Java?

Answer

The ternary operator "?" operator can be used to perform quick if else check, instead of writing an if else block. It operates on three operands. The first operand is the conditional check. If first operand is true, second operand will be executed. Otherwise third operand will be executed.


Share this page:

Report Error in Content