Menu
Question Index
...

What will be the output of the following program?

public class Hero {
    public static void main(String args[]) {
        float ram = 2.5f;
        float charan = 3.6f;
        String str = Float.toString(ram);
        System.out.print(str + "\n");
        String str1 = Float.toString(charan);
        System.out.print(str1);
    }
}


2.5f
3.6f
2.5
3.6
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