?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Arithmetic Operations: Math.pow Method

APCSA-TANYDN

Consider the following code segment.

    double num = 3;
    for (int i=0; i<2; i++)
    {
        num = Math.pow(num, 2);
        System.out.println(num);
    }

What is printed as a result of executing the code segment?

A

8.0
64.0

B

8.0
64.0
4096.0

C

9.0
81.0
6561.0

D

9.0
81.0

E

9.0
81.0
243.0