Menu
Question Index
...

Does the below program successfully compile?

public class ByteConstructors {
    public static void main(String[] args) {
        byte b = 50;
        Byte input = new Byte(b); //LINE X
        Byte input1 = new Byte(b + ""); //LINE Y
        Byte input2 = new Byte(127); //LINE Z
    }
}


Program compiles successfully
Compilation Error at LINE X
Compilation Error at LINE Y
Compilation Error at LINE Z
Compilation Error or Runtime Error for some other reason

Doubts

Problems

Topic: Creating Objects for Primitive Data Types (Byte, Short)

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App