Given the code fragment:
Which code fragment, when inserted at line 3, enables the code to print 10:20?
A. int[] array n= new int[2];
B. int[] array; array = int[2];
C. int array = new int[2];
D. int array [2] ;
Given the code fragment:
Which code fragment, when inserted at line 3, enables the code to print 10:20?
A. int[] array n= new int[2];
B. int[] array; array = int[2];
C. int array = new int[2];
D. int array [2] ;
A
B is correct
int[] array; array=new int[2];
The answer B doesn’t have “new”
First of all, none of the available options is correct. However, the closest one is A, only when the typo is corrected by removing the “n” from the line.
Answer is B
It should be A, but there’s a “n” typo in that answer.
A