Home » JAVA Programming » Methods » Question
  1. What is the output of this program?
    public class Result
    {
    public static void main(String args[])
    {
    Double num = new Double(260.00625023);
    float p = num.floatValue();
    System.out.print(p);
    }
    }
    1. 260.00626
    2. 260
    3. 260.00625023
    4. 260.00
    5. 260.260
Correct Option: A

floatValue() converts the value of wrapper i into float, since float can measure till 5 places after decimal hence 260.00626 is stored in floating point variable p.



Your comments will be displayed only after manual approval.