ternary operator is used where if statement is simple.If the expression 1 is true it expression2 execute otherwise expression 3 will execute.
expression1 ? expression2: expression3
expression1 : Indicates condition for ternary operator.if this is true then expression2 will execute else expression3 will execute.
expression2 : Indicates first statement.
expression2 : second statement.
Example :
z = (a>b) ? a : b;
