Menu
Question Index
...

What will be the output of the following program?

public class Expensives {
    public static void main(String[] args) {
        String textBook = "500";
        Short allInOne = new Short(textBook);
        Short xerox = Short.parseShort(textBook);
        short travel = Short.parseShort(textBook, 16);
        System.out.println(textBook + " " + allInOne + " " + xerox + " " + travel);
    }
}


500 500 500 1F4
500 500 500 1280
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