Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 13 students

2D Array Initialization Type Mismatch

< Prev
Next >

What is the result of attempting to compile the following code segment?

public class Arr2D{
   private int [][] arr;
   Arr2D( int rows, int columns){
     arr = new String[rows][columns];
   }
}
A

Runtime error because the array is not initialized properly.

B

Compilation error due to type mismatch: cannot convert String[][] to int[][].

C

ArrayIndexOutOfBoundsException during execution.

D

No error; the code compiles and runs as intended.

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1varunrajaram122 1m 33s 107
#2kaisuki11 0m 00s 100
#3bommasam00011 0m 11s 89
#4psak1211 0m 26s 74
#5midnightasdark12 0m 44s 46
#6y.seong202722 2m 35s 45
#7dobaonam838612 0m 58s 32
#8singhris00011 1m 16s 24
#9ponneban00012 1m 27s 3
#10mullameh00134 7m 30s -160
Items per page:
10
1 – 10 of 12
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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