?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Concatenating Elements from an Array of Strings

APCSA-ETXYVO

Consider the following code segment.

String[] states = {"Vermont", "Wyoming", "Virginia", "Kentucky", "New York", "Ohio"};
int x=0;

while (x<states.length)
{
    states[states.length-x-1] = states[x]+states[states.length-x-1];
    x++;
}

What string value does states[2] point to after this code segment is executed?

A
WyomingNew YorkWyoming
B
VirginiaKentucky
C
KentuckyVirginia
D
KentuckyVirginiaKentucky
E
VirginiaKentuckyVirginia