File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 36482
    
  16
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: 7052
    
  16

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?
Artlicles 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
 
Similar Threads
Multi dimensional array
array out of bounds
question related to ragged array
SCJP : query regarding increment/decrement operator.
Sudoku Solver