nerdexam
Oracle

1Z0-808 · Question #82

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

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

Working with Selected Classes from the Java API

Question

Given the code fragment:
  1. ArrayList<Integer> list = new ArrayList<>();
  2. list.add(1001);
  3. list.add(1002);
  4. System.out.println(list.get(list.size())); What is the result?

Options

  • ACompilation fails due to an error on line 1.
  • BAn exception is thrown at run time due to error on line 3
  • CAn exception is thrown at run time due to error on line 4
  • D1002

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

#ArrayList indexing#bounds checking#size() method#IndexOutOfBoundsException
Full 1Z0-808 Practice