Menu
Question Index
...

What will be the output of the following program?

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


80.0
74.0
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