Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java: Using a primitive in an identifier?

Name: Anonymous 2006-04-07 16:55

Is it possible to use a primitave value in a reference object's name?
I'm trying to set up a loop to read a list of double values from a file, and make an object for each one.  Something like:

int objectnumber = 1;
Box box-objectnumber = new Box(br.readLine());
objectnumber++;

So that I get 40 Box objects named box1 through box40.  Any ideas?  If I need to, I can just write out a hundred lines of code, but that would look stupid.  And yes, I'm a noob.

Name: Anonymous 2006-04-07 21:24

Success!  I got back from dinner, sorted out some typo-errors, ran it, and it works perfectly.  I also now have a much better grasp on stacks, which makes the assignment a good one, I guess.  And yeah, just using an array did the trick.  Not sure why I thought that wouldn't work...  Oh, well.  Thanks guys!  If anyone actually cares enough to see what the assignment was or what I did, just ask and I'll rapidshare it or something.  Otherwise I won't bother.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List