ternary operator in Java

The Java ternary operator functions like a simplified Java if statement. The ternary operator consists of a condition that evaluates to either true or false, plus a value that is returned if the condition is true and another value that is returned if the condition is false.