Counting the number of columns in a 2D array,

I am trying to count the number of columns in a 2d array. I get an error with the method I wrote. Any help would be appreciated. This is what my instructor wrote on the board, and I can swear I copied it letter for letter. So what am I doing wrong?

Code:

` public static int sumLengths(int[] array)`

{

int count = 0; // keep count of number of columns per row

for (int i = 0; i < array.length; i++)

{

count += array[i].getLength();

// array[i].length; does not work either

}

return count;

}

This is what the compiler says:

Code:

`C:\arrayStuff.java:62: int cannot be dereferenced`

count += array[i].getLength();

^

C:\arrayStuff.java:62: inconvertible types

found : <nulltype>

required: int

count += array[i].getLength();

^

2 errors

I would appreciate any help :(