Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Simple array question

Thread Tools

Re: Simple array question

Posts: n/a
Le 14/05/2008 16:06, Hakan a écrit :
> How do I find the number of rows in a multi dimensional array? The
> number of columns can quite easily be found with A[0].length

Beware, there are no real multi-dimensional arrays in Java like in Ada.
A[0].length may be different from A[1].length.

Reply With Quote
Stefan Ram
Posts: n/a
Patrick <(E-Mail Removed)> writes:
>Beware, there are no real multi-dimensional arrays in Java like in Ada.

I also think so, but still the JLS mentions the term
»multidimensional array« as if there was such a thing:

»A clone of a multidimensional array is shallow«

The example program following this statement then contains:

int ia[][] = { { 1 , 2}, null };


There are different ways to implement a two-dimensional array.
An array of arrays is only one possibility. Another would be a
one-dimensional array with an index calculated from the two
indices of the two-dimensional array. So the means to obtain
the two dimensions depend on the way the multidimensional
array is implemented.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
const and array of array (of array ...) Mara Guida C Programming 3 09-03-2009 07:54 AM
simple, simple array question Peter Bailey Ruby 7 04-08-2008 01:54 PM
length of an array in a struct in an array of structs in a struct in an array of structs Tuan Bui Perl Misc 14 07-29-2005 02:39 PM
Length of Array of Array of Array Tom Perl Misc 3 12-20-2004 05:23 PM
Re: Simple Simple question!!! ASP .Net 0 06-25-2004 04:18 PM