Java-Ternary Operator

Ternary Operator The ternary operator is used to construct conditional expressions of the form : Here, Expression1 can be any expression that evaluates to a boolean value. If Expression1 is true, then Expression2 is evaluated; otherwise, Expression3 is evaluated. The result of the ‘?’ operation is that of the expression evaluated. Both Expression2 and Expression3 are required to … Read more…