I have a two-dimensional array of doubles in Java, which is basically a table of values, and I want to find out how many rows it has ...
It is declared elsewhere (and allocated) as follows:
double[][] table;
then passed to the function ...
private void doSomething(double[][] table)
{
}
In my function, I want to know the length of each dimension without having to pass them as arguments. I can do this for the number of columns, but don't know how to do this for rows ...
int cols = table[0].length;
int rows = ?;
How to do it?
Can I just say ...
int rows = table.length;
Why won't this give an x cols string?
Simon source
share