Given this code in Java:
int i,j;
String[] names;
names[0] = new String("mary");
names[1] = "John";
i = names.length;
j = names[0].length();
I need to find the error. As far as I can tell, lines 1, 2, 4, and 5 are correct because they involve simple instance variables, adding elements to arrays, and finding the length of an array. However lines 3 and 6 are weird.
Can you add a string to an array like the way done in line 3? If the array is full of strings, can you index one out and use the length() method on it?