Menu
Question Index
...

What will be the output of the following program?

public class Numbers {
    public static void main(String args[]) {
        String numbers[] = {"123", "133", "143", "153"};
        int one = Integer.parseInt(numbers[0]);
        float two = Float.parseFloat(numbers[1]);
        double three = Double.parseDouble(numbers[2]);
        byte four = Byte.parseByte(numbers[3]);
        System.out.print(one + " " + two + " " + three + " " + four);
    }
}


123 133.0 143.0 153
123 133.0f 143.0 153
Some other output
Compilation Error or 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