Menu
Question Index
...

What will be the output of the following program?

public class StringToNumbers {
    public static void main(String[] args) {
        String input = "123";
        int i = Integer.parseInt(input);
        Short s = Short.parseShort(input);
        float f = Float.parseFloat(input);
        long l = Long.parseLong(input);
        System.out.println(i + s + f + l);
    }
}


492.0
123123123.0123
Compilation Error
Runtime Error

Doubts

Problems

Topic: Converting Numbers to and from Strings 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