Menu
Question Index
...

What will be the output of the following program?

class Test1
{
    public static void main(String s[])
    {
        float f = 75.0f;
        double d = 75.0;
        int i = 75;

        if( f == d )
        {
            if( f == i )
            {
                System.out.println("f, d and i are equal");
            }
            else
            {
                System.out.println("f, d are equal but i is not equal");
            }
        }
        else
        {
            System.out.println("f and d are not equal");
        }
    }
}


f, d are equal but i is not equal
f, d and i are equal
f and d are not equal
Program does not compile since data types are different

Doubts

Problems

Topic: Nested if Statements 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