Consider the code segment below. Which of the following statements is not true? int[] g; g = new int[ 23 ]; A. The first statement declares an array reference. B. The second statement creates the array. C. g is a reference to an array of integers. D. The value of g[ 3 ] is -1.

Respuesta :

Answer:

D. The value of g[ 3 ] is -1.

Step-by-step explanation:

Given Code:

[tex]Line\;1\; :[/tex]       int[] g;

Line 2 : = new int[23];

Interpretation of the Code:

The first line of the code is declaring an array of int data type and reference it to a variable g.

The second line of code creates a new instance of this variable and define it to have 23  indices (from 0 to 22) in which values can be stored. Initially, each index holds a value of 0.

From above information, it is clear that option D is not true as the value of g[3] will be 0.