The compiler is expecting something like:
Type identifier =
expression;
and of course the result type of the expression has to be compatible with the Type.
You have:
Student[ i ] aStudent = new Student();
..(Type)....(Ident)..=....(Expr)...
Student[ i ] is not a valid type.
It might be a good way to reference the i'th element of an array named Student, but that doesn't work as a Type.
Now, Student[] without the
i could be a valid type, as in "an array of Student objects", but that would not match the result of the expression "new Student()" which is of type Student.
I imagine what you want is to assign a new Student() to each element in array of Students.
So
you should declare a new array of the desired size, as in:
Student[] theStudents = new Student[ SIZE ];
and then loop thru them and assign a new Student() to each of these, as in:
theStudents[ i ] = new Student();
OK?
[ October 24, 2002: Message edited by: Dave Landers ]