PRACTICE / UNDERSTAND / REPEAT

Java: Arrays

Practice arrays with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

20 questionsAnswers explainedFree · no login
Question 1 of 20
Arrays · MCQQuestion link ↗

What value is stored in the last array element?

int[] values = new int[3];
System.out.println(values[2]);
Choose one answer
Answer & explanation

Answer: 0

Elements of a newly allocated int array have the default value zero.