Given the code fragment:

public static void main(final String[] args) throws Exception {
    String[][] arr = {{"A", "B", "C"}, {"D", "E"}};
    for (int i = 0; i < arr.length; i++) {
        for (int j = 0; j < arr[i].length; j++) {
            System.out.print(arr[i][j] + " ");
            if (arr[i][j].equals("B")) {
                break;
            }
        }
        continue;
    }
}

What is the result?

A.

A B C

B.

A B C D E

C.

A B D E

D. Compilation fails.

题解

程序第 10 行的 if 条件式成立的时候会跳出循环。当程序输出「B」字符串后,这个 if 条件式就会成立,然后跳出里面的 for 循环,接着依然会继续运行外面的 for 循环。因此在这里只是「C」字符串被跳过输出了而已。