Limited access

Upgrade to access all content for this subject

Consider the following code segment.

String[] drinks = {"milk", "soda", "water", "milkshake", "coffee"};
String s = " ";

for (int i=0; i<drinks.length; i++) 
{
    int x = drinks[i].length()/3;
    s += drinks [x];
}
System.out.println(s);

What will print to the console when the following code segment is executed?

A

milksodawaterorange juicecoffee

B

sodasodasodamilkwater

C

sodasodasodamilkshakewater

D

milkmilkmilkwatersoda

E

sodasodawatermilkshakewater

Select an assignment template