posted 20 years ago
Martyn,
There are a few changes you need to make to your code, inorder that it shows up meaningful results.
Firstly, I did not understand why you had you a for loop in the addStudent() method in the Storage class, I have removed the for loop, and instead used the counter from your StudentTest class. The changes are shown below, see the commented part,
Because of the above for loop which has been commented I think you were getting the same Student object printed out all the time. It was your last student object that was getting printed, because you set the index to zero and added the last Student object to all the indexes of the Student array. Just try to think over the logic you will get the answer.
Next, the problem with the student objects not showing up properly, you need to make the following change here in your StudentTest() class.
Just call the getName() method on your student object, that will display the names.
The entire code is given below, it works fine. I have removed some of the package statements and eased the access modifiers to make it easy on me.