Write a program in java to demonstrate ternary operator?

class TernaryOperator

{

                public static void main(String arg[])

                {

                                int a=9,b=7;

                                int max=(a>b)?a:b;

                                System.out.println(max);

                }

}

Ternary Operator.PNG

, , , , , ,

Leave a Reply