This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I fill a 2d array

 
Joana Silva
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello , so I have String[][] tmp = new String[800][800];

how do I feel him without the manual [0][0]?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47292
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must fill the array either by row-wise or column-wise processing.
 
Amir Iqbal
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,

 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yuva Java wrote:


Please check your private messages for an important administrative matter
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic