Tuesday, March 18, 2008

ternary Operator

/* 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);

}
}

No comments: