Menu
Question Index
...

What will be the output of the following program?

public class AdditionOfBytes {
    public static void main(String[] args) {
        byte b = (byte) 129;
        Byte input = new Byte(b);
        Byte input1 = new Byte((byte) 127);
        Byte input2 = new Byte(b + "");
        System.out.println(input + input1 + input2);
    }
}


-381
-127
Compilation Error
Runtime Error

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