View Single Post
  #1 (permalink)  
Old 08-05-2007, 05:40 AM
mathias mathias is offline
Member
 
Join Date: Jul 2007
Posts: 40
mathias is on a distinguished road
ERROR: nullPointerException
Hi, Please check this
Code:
import TerminalIO.KeyboardReader; public class manyStudents { public static void main (String [] args) { KeyboardReader reader = new KeyboardReader(); Student[] student = new Student[500]; int stuNumb = reader.readInt ("Enter the number of students (max is 500): "); for (int i = 0; i < stuNumb; i++) { String stuName = reader.readLine ("Enter the name of sutden #"+ (i+1) +": "); student[i].setName(stuName); int testNumb = reader.readInt ("Enter the number of tests for "+ student[i].getName() +": "); } } }
This code gives me a null pointer exception at line 11...
why? how can i fix it?
Thanks
Reply With Quote
Sponsored Links