Menu
Question Index
...

What will be the output of the following program?

class FloatConversion
{
    public static void main(String args[])
    {
        int i = 44;
        float f = 98.42f;
        double d = 103.67;
        
        f = i;
        d = f;
        i = d;

        System.out.println("i = " + i);
        System.out.println("f = " + f);
        System.out.println("d = " + d);
    }
}


i = 44
f = 44.0
d = 44.0
i = 103.67
f = 44
d = 98.42
Program does not compile
i = 44
f = 98.42
d = 103.67

Doubts

Problems

Topic: Type Conversion 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