Class with inner class array for storage getting NullPointerException
Date: 02/16/05

Date: 15 Feb 2005 18:07:08 -0800

Yay, I got my first java.lang.NullPointerException(NPE) =) Here's my
complete code:

It's an employee gross program that computes reg and overtime pay/hours
and totals for as many employees as the user wants. It's for my first
class on java.

I've been searching alot about class arrays & NPEs but found little,
this is the best clue I've found about NPEs:

Here's the important code, the inner class of payroll, the
instantiation(s), and the method that is supposed to record in the
storage(inner)class. The record method/storage class is definately the
cause of this NPE. I'll post exactly what JGrasp is returning on run
after the code.

 private class storage
 { private String name="";
    private double hours=0, rate=0, regHrs=0, regPay=0, ovtHrs=0,
 } /*After reading
I decided to declare the var.s so they were not luck*/
/*class array storage*/
storage pay[] = new storage[emps];
/*reocrd-*/private void record()
 {pay = new storage[emps];

         pay[c].name = name;
         pay[c].hours = hours;
         pay[c].regHrs = regHrs;
         pay[c].ovtHrs = ovtHrs;
         pay[c].regPay = regPay;
         pay[c].ovtPay = ovtPay;


...inputing info...then it hits record(); and BAM:
Exception in thread "main" java.lang.NullPointerException
        at payroll$storage.access$002(
        at payroll.record(
        at payroll.start(
        at payroll.main(

 ----jGRASP wedge2: exit code for process is 1.