Menu
Question Index
...

What will be the output of the following program?

public class TypeConversion2 {
    public static void main(String... strings) {
        byte i = 21;
        long s = 12345678;
        int b = 256;
        short l = 4310;
        String st = "58.99";
        s = b;
        b = l;
        l = i;
        i = (byte) (Double.parseDouble(st) + i);;
        System.out.println("b = " + b + " s = " + s + " i = " + i + " l = " + l);
    }
}


b = 4310 s = 4310 i = 80 l = 21
b = 4310 s = 4310 i = 79 l = 21
b = 4310 s = 256 i = 80 l = 21
b = 4310 s = 256 i = 79 l = 21
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Collections - Utility Classes 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