Member is class consisted of member informaiton such as firstname, lastname, phone etc.
would anyone please point out what this function gave me NullPointerException runtime error? I think I initialized everything.
thanks
public static void read(Member box[], int count)
{
Scanner reader = null;
try
{
reader = new Scanner(new FileReader("database.txt"));
int id;
String type, fn, ln, ph;
Double fee;
while(reader.hasNextLine())
{
id= reader.nextInt();
type= reader.next();
fn= reader.next();
ln= reader.next();
ph= reader.next();
fee= reader.nextDouble();
System.out.println(count);
box[count]= new Member(id, type, fn, ln, ph, fee);
box[count].output();
//count++;
}
}
catch(FileNotFoundException e)
{
System.out.println("File not Found!");
}
catch(IOException e)
{
System.out.println("Error reading");
}
catch(NoSuchElementException e)
{
System.out.println("done reading");
}
}