This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
My problem is basically the following. I would like to get out data from a non-static array, so in order to do that I must make an instance of it. My problem is that I don't really now how to do that.
My code looks like the following, and it is obviously wrong:
I could solve this problem if I made Values static, but I cannot do that because Values array comes from a package, the source code of which I don't own.. So basically my question is about getting the value of a non-static array method. I know it's a very easy problem, but I would be really thankful if someone could guide me towards the solution to this basic problem. Thanks in advance!
Also note that, by convention, Values() should be values()--methods and variables start with a lowercase letter.
And finally, not that it's a big deal here, but still something to be aware of, every time you call Values() (that is, both iterations of your for loop), you're creating a new array. And the way you're doing it, you're only using one value from each array and ignoring the rest. The usual way to do it would be to call the method once, store the results in a variable, and then use that variable for the iteration.
Joined: Mar 23, 2013
Thank you very much, I finally resolved this problem in the way you mentioned in the second half of your post. I've never found a site before, where people are this helpful with beginners, thanks again!