| preferred AP College board partner for AP classes
AP Computer Science A/Unit 6: Array
Start Practice TestPractice Test
About Exam
easy Solved by 5 students
Array Index Out Of Bounds
< Prev
Next >

What error, if any, occurs when the code is executed?

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

ArrayIndexOutOfBoundsException

C

NullPointerException

D

Compilation Error

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy