Sail E0 Webinar
Question


What is the output of this program?


class Output {
public static void main(String args[]) {
Double i = new Double(257.578123456789);
float x = i.floatValue();
System.out.print(x);
}
}
Options:
A .  0
B .  257.0
C .  257.57812
D .  257.578123456789
Answer: Option C

floatValue() converts the value of wrapper i into float, since float can measure till 5 

places after decimal hence 257.57812 is stored in floating point variable x.
Output:
$ javac Output.java
$ java Output
257.57812



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers