File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

How do I fill a 2d array

Joana Silva

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

Joined: Oct 13, 2005
Posts: 38007
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

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.



i am Java +ve Now !
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10170

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!]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: How do I fill a 2d array
Similar Threads
For that if use the array? Which is the its main function?
How do I make the paddle?
How to set a screen size
Method binding
Adding arrays?