I have a question about arrays to ask. I was reading an Intro to Java book that I'm using for a programming class, and i was reading ahead of where I am to the chapter on Arrays. We did an assignment in class that looked like it would be easier if using arrays, so I tried to remake it. What I tried doing was making a class array, using a class I created named Student. I also made the array so that the user could enter the number of students to create, and also the data to be used in a method to set all instance variables of the class Student.
Student[leftbr][rightbr] Scholar = new Student[leftbr]studentCount[rightbr]
is what I used, with studentCount being an int input by the user one line above this. I use a for loop with i starting at 0, and have the user input data to be used for the arguments of the setAll method of the Student class. What I'd like to know is why I keep getting a "NullPointerException" message when I attempt to run the program? Can an object within an array (i.e. Scholar[leftbr]0[rightbr]) utilize a method of the original class, Student? If any of that doesn't make sense, feel free to let me know, because sometimes I'm a bit unclear in my explanations. Thanks in advance for any help you can give me. (And by the way, I read through the entire chapter on arrays in the book. It says that you can use a class for an array, but doesn't reference anything about the methods after that.)
"Never underestimate the predictability of stupidity." - Bullet-Tooth Tony (Snatch)