wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How do I fill a 2d array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I fill a 2d array" Watch "How do I fill a 2d array" New topic
Author

How do I fill a 2d array

Joana Silva
Greenhorn

Joined: Feb 28, 2009
Posts: 5
hello , so I have String[][] tmp = new String[800][800];

how do I feel him without the manual [0][0]?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38492
    
  23
There is no such thing as a 2D array; what you have as an array of arrays.

tmp = new String[][]{{"word", "wordd", "worddd"}, {"wordddd", "worddddd"}}; maybe?

You may be able to obtain the contents for the array from a List.

There are bound to be other ways: anybody else?
Yuvamurugan Pugazhenthi
Greenhorn

Joined: Oct 19, 2007
Posts: 4
You must fill the array either by row-wise or column-wise processing.
Amir Iqbal
Ranch Hand

Joined: Jun 23, 2007
Posts: 97
unfortunately i am unable to understand your question.
by the way in my opinion

1) when you create the object of an array and give the the size (ie 800 * 800 in your case) it is automatically initiazed with null at every index.
2) and second option is you just need one loop from index zero to 800 and fill up any string at all the indices.

right

Regards,


i am Java +ve Now !
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Yuva Java wrote:


Please check your private messages for an important administrative matter


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I fill a 2d array