Conditional Operator in Java

Notes:

Conditional Operator in Java Programming Language:

Conditional Operator ( ?: ): is the ternary operator in Java. It accepts 3 operands.
(operand1) ? operand2 : operand3;
Where:
operand1: must be a condition; which must be evaluated to true or false
operand2: value // true part
operand3: value // false part

Ex: Program to find the given number is even or odd

package conditionalopertordemo;

public class ConditionalOpertorDemo
{
public static void main(String[] args)
{
int num = 10;
System.out.println(num + " is " + ((num%2==0) ? "even" : "odd"));

}
}