Re: Basic array question, need help

From: Chris Shepherd (chshNOSPAM_at_cogeco.ca)
Date: 12/10/03


Date: Wed, 10 Dec 2003 00:31:17 -0500

KellyH wrote:
> Here's my problem:
> My problem is that I can't figure out how to load the array. If I do it in
> the Enter button event, then a new array is created each time an integer is
> entered. I tested this by adding the current int to the int in the previous
> cell. Oh, I am also storing the logical end of the array in the 0 cell. If
> I try to load the array in the main, I get an error: Non-static method
> load_aNum cannot be referenced from a static context. We had a project
> previously where I used two arrays (pre-filled, not using input numbers),
> and I loaded it in the main, and it worked fine. Don't know why this won't
> work.

Are you able to make use of the ArrayList object at all? It may be far
simpler to use that than an actual integer array. Just make sure you use
Integer.parseInt() to validate the input, and then add it to your
ArrayList object (which should, of course, be declared at the class level).

-- 
Chris Shepherd