nerdexam
Oracle

1Z0-808 · Question #62

1Z0-808 Question #62: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #62. The question stem and answer options stay visible for context.

Creating and Using Arrays

Question

Given: public class Test { public static void main(String[] args) { String[][] chs = new String[2][]; chs[0] = new String[2]; chs[1] = new String[5]; int i = 97; for (int a = 0; a < chs.length; a++) { for (int b = 0; b < chs.length; b++) { chs[a][b] = "" + i; i++; } } for (String[] ca : chs) { for (String c : ca) { System.out.print(c + " "); } System.out.println(); } } } What is the result?

Options

  • A97 98 99 100 null null null
  • B97 98 99 100 101 102 103
  • CCompilation rails.
  • DA NullPointerException is thrown at runtime.
  • EAn ArrayIndexOutOfBoundsException is thrown at runtime.

Unlock 1Z0-808 to see the answer

You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#jagged arrays#nested loops#array initialization#null references
Full 1Z0-808 Practice