What value is stored in the last array element?
int[] values = new int[3];
System.out.println(values[2]);Answer & explanation
Answer: 0
Elements of a newly allocated int array have the default value zero.
Practice arrays with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
int[] values = new int[3];
System.out.println(values[2]);Answer: 0
Elements of a newly allocated int array have the default value zero.