Sunday, March 25, 2018

Ternary Operator of Java Programme

/* Example of  Ternary Operator */
package Conditional;
public class Conditional
{
    public static void main(String[] args)
    {
        int a = 10, b = 15;
        int result;
        result = (a > b) ? a : b;
        prln("Maximum of "+a+ " and "+b+ " is: \t"+result);
    }
    static void prln(Object anyObject)
    {
        System.out.println(anyObject);
    }
    static void pr(Object anyObject)
    {
        System.out.print(anyObject);
    }
   
}












Share:

0 comments:

Post a Comment

Blogger templates