Java | Data Types | Question 3

Last Updated :
Discuss
Comments

Predict the output of the following program.

Java
 class Test
{
    public static void main(String[] args)
    {
        Double object = new Double("2.4");
        int a = object.intValue();
        byte b = object.byteValue();
        float d = object.floatValue();
        double c = object.doubleValue();

        System.out.println(a + b + c + d );

    }
}

8

8.8

8.800000095367432

Share your thoughts in the comments