/* Program to demonstrate the ternary Operator */
class Ternary
{
public static void main(String args[])
{
int value1 = 1;
int value2 = 2;
int result;
boolean Condition = true;
result = Condition ? value1 : value2;
System.out.println("Result is : "+result);
}
}
0 comments:
Post a Comment