Question
class Output {
public static void main(String args[]) {
Double i = new Double(257.578123456789);
float x = i.floatValue();
System.out.print(x);
}
}
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);
}
}
Answer: Option C
Was this answer helpful ?
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 ?
Submit Solution