nerdexam
Exams1Z0-803Questions#43
Oracle

1Z0-803 · Question #43

1Z0-803 Question #43: Real Exam Question with Answer & Explanation

The correct answer is C: AStringIndexOutOfBoundsException is thrown at runtime. The code compiles fine. At runtime an IndexOutOfBoundsException is thrown when the second list item is added.

Question

Given: public class x{ public static void main (string [] args){ String theString = "Hello World"; System.out.println(theString.charAt(11)); } } What is the result?

Options

  • AThere is no output
  • Bd is output
  • CAStringIndexOutOfBoundsException is thrown at runtime
  • DAnArrayIndexOutOfBoundsException is thrown at runtime
  • EA NullPointException is thrown at runtime
  • FA StringArrayIndexOutOfBoundsException is thrown at runtime

Explanation

The code compiles fine. At runtime an IndexOutOfBoundsException is thrown when the second list item is added.

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice