Limited access

Upgrade to access all content for this subject

Consider the following code segment.

// there are single spaces between each word in state
String state = "Mississippi is a southern state";
int a = state.substring(state.indexOf("p")).indexOf(state.substring(state.indexOf("i"),3));
System.out.print(a);

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

A

1

B

4

C

7

D

8

E

12

Select an assignment template