Menu
Question Index
...

What will be the output of the following program?

public class ValueIs {
    public static void main(String args[]) {
        int i = 10;
        float f = 10.0f;
        long l = 10;
        double d = 10.0d;
        char c = 'a';
        boolean b = true;
        Object o = new String("Merit Campus");
        System.out.print(String.valueOf(i) + ", ");
        System.out.print(String.valueOf(f) + ", ");
        System.out.print(String.valueOf(l) + ", ");
        System.out.print(String.valueOf(d) + ", ");
        System.out.print(String.valueOf(c) + ", ");
        System.out.print(String.valueOf(b) + ", ");
        System.out.print(String.valueOf(o));
    }
}


10, 10.0f, 10, 10.0d, a, true, Merit Campus
10, 10.0, 10, 10.0, a, true, Merit Campus
10, 10.000, 10, 10.00000, 97, true, Merit Campus
10, 10.0f, 10, 10.0d, 97, true, Merit Campus
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Data Conversion Using valueOf 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