Given the following code fragment:
Which code fragment outputs red:blue:small:medium?
red:blue:small:medium
Nested enhanced for loops traverse a two-dimensional array row by row: the outer loop obtains each String[] row, and the inner loop prints every String in that row. This produces the elements in order as red, blue, small, and medium, each followed by a colon.
for
String[]
String
red
blue
small
medium
Community Discussion