Problem in assigning values to 2-dimensional arrays...
Joined: Nov 02, 2007
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.......
Joined: Sep 17, 2006
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."