Menu
Question Index
...

What will be the output of the following program?

public class ConvertToShort {
    public static void main(String[] args) {
        Byte input = new Byte((byte) 70);
        System.out.print(input + " ");
        short s = input.shortValue();
        System.out.print(s);
    }
}


70 -186
70 70
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