| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice TestPractice Test
About Exam
easy Solved by 1 students
Java 2D Array Initialization Syntax
< Prev
Next >

Which error stops this code from compiling?

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

The main method is not defined as static.

B

The variable ‘numbers’ is not properly initialized.

C

The print statement is missing a semicolon at the end.

D

The array is declared with incorrect syntax using a comma instead of separate square brackets for each dimension.

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