?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

Arrays and Sequential Execution

APCSA-74YHDR

Consider the following code segment.

int[] myArray = {0,4,9,-16}; 
myArray[0]=myArray[3]; 
myArray[3]=myArray[0]; 
System.out.println(myArray[3]*-2);

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

A

0

B

8

C

18

D

32

E
ArrayIndexOutOfBoundsException