Java is equipped with a **selection operator** that allows us to construct
a **conditional expression**. The use of a conditional expression can in
some cases simplify the code with respect to the use of an `if-else`
statement.

*Syntax:*

condition?expression-1:expression-2

is a boolean expression*condition*and*expression-1*are two arbitrary expressions, which must be of the same type*expression-2*

*Semantics:*

Evaluate ` condition`. If the result is

*Example:*

System.out.println("bigger value = " + (a > b)? a : b);

The statement in the example, which makes use of a conditional expression, is equivalent to:

if (a > b) System.out.println("bigger value = " + a); else System.out.println("bigger value = " + b);

Note that the selection operator is similar to the `if-else` statement,
but it works at a different syntactic level:

- The selection operator combines
*expressions*and returns another expression. Hence it can be used wherever an expression can be used. - The
`if-else`statement groups*statements*, and the result is a composite statement.