?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Goodbye String Output

APCSA-Y84VBY

Consider the following code segment.

String s ="goodbye";
System.out.println(s.substring(s.substring(s.length() 
– s.indexOf("d")).length()));

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

A

bye

B

3

C

dbye

D

2

E

odbye