2D Arrays: Creation and Access

AP Computer Science A· difficulty 2/5

String[][] s = {{"a", "b"}, {"c", "d"}};
System.out.println(s[0][1] + s[1][0]);

What is printed?

  • A

    ac

  • B

    ab

  • C

    cd

  • D

    bc

    check_circle

Explanation

s[0][1] is "b" and s[1][0] is "c". Concatenation gives "bc".

Want 10 more like this — adaptive to your weak spots?

Related questions