Java - What is the output: array length update?

Question

What is the output of the following code?

int[] roll = new int[5]; // Create an array of 5 elements
roll.length = 10;


Click to view the answer

// A compile-time error. 
roll.length = 10;

Note

The length property of an array is final. You cannot modify it.

You cannot change the length of an array after it is created.