Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Re: Simple array question

 
 
Patrick
Guest
Posts: n/a
 
      05-14-2008
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.

--
Patrick
http://iang.info
 
Reply With Quote
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      05-14-2008
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«

http://java.sun.com/docs/books/jls/t...ml/arrays.html

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
 
 
 
Reply

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!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM



Advertisments