?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

CharAt Method

APCSA-86BL1G

Consider the following code.

 String str = "Goodbye";
 char c = str.charAt(7);
 System.out.println(c);

What is printed as a result of executing this code?

A

e

B

"

C

-1

D

The code will not compile.

E

IndexOutOfBounds Exception will be thrown.