Menu
Question Index
...

What will the output of the following program?

class Operators22
{
    public static void main(String s[])
    {
        double d1 = 21.5;
        double d2 = 0.5;

        boolean condition = ( d1 / d2 ) < 15;

        int result = condition ? 77 : 99;

        System.out.println("result = " + result);
    }
}


Program does not compile
result = 99
result = 77
Run time error

Doubts

Problems

Topic: Ternary Operator In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App