Menu
Question Index
...

What will be the output of the following program?

class IntegerConversion
{
    public static void main(String args[])
    {
        long l = 787878;
        int i = 656565;
        short s = 3333;
        byte b    = 111;
        
        l = i;
        i = s;
        s = b;

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


l = 656565
i = 3333
s = 111
b = 111
l = 787878
i = 656565
s = 3333
b = 111
l = 111
i = 111
s = 111
b = 111
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