?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

Accessing Array Contents: Single Array

APCSA-AKEYX4

Consider the following code segment.

int[] q = {4, 2, 12, 13, -5};
System.out.println(q.length + q[3]);

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

A

15

B

16

C

17

D

18

E

Nothing is printed because of an error.