Program to demonstrate the 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);
   
         }
}
   

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|