【笔试题】Java Data Types

时间:2022-05-14 16:24:29

Java 知识测试 Java Data Types
Question 1
Predict the output of the following program.

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

A. 8
B. 8.8
C. 8.800000095367432

参考答案

C