Analyze the following code:
```
public class Test {
public static void main(String[] args) {
int[] a = new int[4];
a[1] = 1;
a = new int[2];
System.out.println("a[1] is " + a[1]);
}
}```
a. The program has a compile error because new int[2] is assigned to a.
b. The program has a runtime error because a[1] is not initialized.
c. The program displays a[1] is 0.
d. The program displays a[1] is 1.
c After executing the statement a = new int[2], a refers to int[2]. The default value for a[0] and a[1] is 0.
You might also like to view...
When choosing a font color using the Font Color button arrow, colors are displayed in group by the ________ that is applied to the document
Fill in the blank(s) with correct word
When you ________ a formula, you locate and correct errors
A) constrain B) debug C) solve D) calculate