What happens when calling the following method with a non-null and non-empty array?
public static void myMethod(String[] names) { names[names.length] = "Times Square"; }
D.
names.length is the number of elements in the array.
The last valid index in the array is one less than names.length.
In Java, arrays do not resize automatically.
The code throws an ArrayIndexOutOfBoundsException.