java if ternary code example Example: ternary operator java booleanExpression ? expression1 : expression2;