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

Dereferencing a Null 2D Array Row

Mark
< Prev
Next >

What is the result when the following code is executed?

public class NullRow {
    public static void main(String[] args) {
        int[][] arr = new int[2][];
        arr[0] = new int[]{1, 2};
        arr[1] = null;
        System.out.println(arr[1].length);
    }
}
A

0

B

2

C

NullPointerException at runtime

D

Compilation error

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2y.seong202711 0m 23s 77
#3busemagngr01 1h 00m -3,610
Items per page:
10
1 – 3 of 3

AI Tutor

How can I help?

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