Because you are using an array (Student[]) there is no real add functionality. If you can I would recommend using something like List<Student> which will allow you to dynamically size the amount of students in the course. However, if you are stuck using an array you can do something like. Student[0] = new Student(....). With an array you can only assign the value at the position. If the position doesn't exist you will get an out of bounds exception.
No comments:
Post a Comment