wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Multidimensional array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multidimensional array" Watch "Multidimensional array" New topic
Author

Multidimensional array

saloni jhanwar
Ranch Hand

Joined: Feb 09, 2012
Posts: 583



Tell the difficulties that i am difficult.
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Two nested for loops that iterate from 0 to < the array.length should work nicely.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38509
    
  23
There is no such thing as a 2D array. You do realise you are going to hit some nulls when you iterate that array?
Edwin Torres
Ranch Hand

Joined: Mar 19, 2011
Posts: 55

Like they said, initialize the third row (to avoid the null) and use a nested loop:


Twitter: @realEdwinTorres
Blog: java Friendly
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Working with arrays of arrays can be confusing, requiring extrapolating simple ideas you probably already know into more complex ones in ways you might not think of or realize are possible. For that reason, I put together a short runnable example that should answer most of your questions. Please ask if you have more.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7713
    
  20

Edwin Torres wrote:Like they said, initialize the third row (to avoid the null) and use a nested loop:

Or indeed:
Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
saloni jhanwar
Ranch Hand

Joined: Feb 09, 2012
Posts: 583

Thanks everyone
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multidimensional array