Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 6: Array
Start Practice TestPractice Test
About Exam
easy Solved by 1 students

Array Index Out Of Bounds

Mark
< Prev
Next >

What is the result of executing the following code segment?

public class ArrayError {
  public static void main(String[] args) {
      int[] values = {1, 2, 3};
      System.out.println(values[3]);
  }
}
A

No error, prints 0

B

NullPointerException

C

Compilation Error

D

ArrayIndexOutOfBoundsException

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|