Ates,
In Java, arrays don't necessarily have to be "orthogonal" if that's an apt
description.
For example, take this following code fragment;
// an array of array references String [][] arrays; //
assign memory to hold 3 references to 3 arrays of arrays
arrays = new String[3][]; // assign 3 different length arrays to
each of the 3 array of array references arrays[0] = new String[3];
arrays[1] = new String[4]; arrays[2] = new String[2]; int i = 0;
for(String[] element : arrays){ System.out.println("arrays["+
i++ +"] length : "+element.length); }
You can see the length of each of the String [] arrays at each of the indexes
in the first dimension aren't constrained to be the same length.
Michael
> Date: Tue, 20 Jan 2009 02:51:33 -0800> Subject: [java programming] length
> attribute> From: [email protected]> To:
> [email protected]> > > Hi all,> > How can i get the
> length of a multi dimensional array.> Fo example:> If i have> String
> names[][]=new String[3][2];> I can't get the second dimension with>
> names[].length;> but> names [1].length;> works fine. Is there any other ways
> to get the length attribute for> multi dimensionals?> > Regards,> > Ates> > >
> _________________________________________________________________
Net yourself a bargain. Find great deals on eBay.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Frover%2Eebay%2Ecom%2Frover%2F1%2F705%2D10129%2D5668%2D323%2F4%3Fid%3D10&_t=763807330&_r=hotmailTAGLINES&_m=EXT
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---