I have a program class and a student class, the student constructor creates a student and stores it in the array, the problem is when I try to print the array I get the following printed out:
metClassTwo.Student@5c74c3aa
How can I get the program to print the array details correctly?
print method:
public static void listStudent() {
for (int i = 0;i < myClassCount;i++) {
if (myClass[i] != null) {
System.out.println(myClass[i]);
}
}
}
myClassCount
is incremented by one each time a student is added.
Array:
static final Student[] myClass = new Student[6];