I have to set up a constructor to go with my array program. One of my data members is "private int scores". My constructor is supposed to take an array of integers as a parameter. It then calls a setScore method passing it the parameter array. First, is it possible to instantiate an array without setting its bounds? I need to be able to enter a different amount of numbers each time I run the program, but I can't get it to compile without putting a bound in...ie: private intscores = new int. Second, when I call the method, I know I put "setScores()" but how would I pass it the parameter array? Thanks.
No, you cannot instantiate an array without setting its size. However, you can declare an instance variable without instantiating it, and then instantiate it in the constructor when you know the size...
[ December 01, 2007: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org