Menu
Question Index
...

What will be the output of the following program?

class IntegerConversion
{
    public static void main(String args[])
    {
        long l = 55;
        int i = 44;
        short s = 33;
        byte b    = 22;
        
        i = l;
        s = i;
        b = s;

        System.out.println("l = " + l);
        System.out.println("i = " + i);
        System.out.println("s = " + s);
        System.out.println("b = " + b);
    }
}


l = 55
i = 44
s = 33
b = 22
l = 22
i = 33
s = 44
b = 55
l = 55
i = 55
s = 55
b = 55
Program does not compile.

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