aspose file tools*
The moose likes Java in General and the fly likes Problem in assigning values to 2-dimensional arrays... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in assigning values to 2-dimensional arrays... " Watch "Problem in assigning values to 2-dimensional arrays... " New topic
Author

Problem in assigning values to 2-dimensional arrays...

sumukha kris
Greenhorn

Joined: Nov 02, 2007
Posts: 18
Hello,

I'm doing a project in java and im not able to assign the values which are got from for loop to the 2-dimensional array.
Can anyone tell me how to assign the values and print them?

the code is:



How will i assign s and t values to temp array?

Thanks in anticipation.......
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Can anyone tell me how to assign the values and print them?
Exactly the way you are printing them is how you assign them. What is call to gr.getGridArray();, and what does it return ? In other words, where are the temperatures coming from. Based on sparse information, it looks like get grid array is where the information is coming from. Nested loops are done exacly as you have the print statement, to assign you just make the array at position [ s ] [ t ] to be the left-hand side of an assignment operator. IOW temp[s][t] = datapoint;

You may have to do a toString() on the temp[][], but to answer your question you just tediously work out the square brackets and the indexing and then that position in the array is accessed like any variable.


"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in assigning values to 2-dimensional arrays...