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 Android Security Essentials Live Lessons this week in the Android 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: 38033
    
  22
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: 37
Like they said, initialize the third row (to avoid the null) and use a nested loop:


Follow me: @CompGuyProbs
Read me: Freehold Computers Examiner
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: 7549
    
  18

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
 
Consider Paul's rocket mass heater.
 
subject: Multidimensional array
 
Similar Threads
Multi dimensional array
SCJP : query regarding increment/decrement operator.
question related to ragged array
array out of bounds
Sudoku Solver