title: I'm getting a java.lang.NullPointerException: null error and I don't know what is missing
body: <pre><code> public void FillArray()
  {
      for (int i = 1; i &lt; numEmp; i++)
      {
          employees[i] = true;
      }
  }
  </code></pre>
  
  <p>I think this part may be the reason I'm getting the NullPointerException error, but I don't know what I'm missing. I have put my full code for the program below just in case there is something that is wrong with that that is giving me that error message.</p>
  
  <p>//client class</p>
  
  <pre><code>public class Downsize
  {
      public static void main (String [] args)
      {
          System.out.print("Do you want to downsize the company? (Y/N): ");
          String dummy = APIO.getString().toUpperCase();        
          while (dummy.equals("Y"))
          {
              Employee employee = new Employee();
              System.out.print("Do you want to downsize the company? (Y/N): 
              dummy = APIO.getString().toUpperCase();
          }
      }
  }  
  </code></pre>
  
  <p>//object class</p>
  
  <pre><code> public class Employee
      {
          int numEmp;
          int sprayer;
          int winner;
          boolean [] employees;
  
          public Employee()
          {
              System.out.print("How many employees? (0 to end): ");
              int numEmp = APIO.getInt();
              System.out.print("Who gets the spray can first?: ");
              int sprayer = APIO.getInt();
              FillArray();
              Selection();
              Winner();
          }
  
          public void FillArray()
          {
              for (int i = 1; i &lt; numEmp; i++)
              {
                  employees[i] = true;
              }
          }
  
          public void Selection()
          {        
              System.out.println("EM="); //debugging method
              for (boolean em: employees)
              {
                  System.out.println(em);
              }
  
              int complete = numEmp;
              while (complete &gt; 1)
              {
                  System.out.print("spraycan passed to #" + sprayer);
                  if ((sprayer + 1) &gt; numEmp)
                  {
                      sprayer = 0;
                  }
                  while (employees[sprayer + 1] == false)
                  {
                      sprayer++;
                      if (sprayer &gt;= numEmp)
                      {
                          sprayer = 0;
                      }
                  }
                  employees[sprayer + 1] = false;
                  System.out.print("  -  sprays #" + (sprayer + 1) + "'s hair");
                  complete--;
                  sprayer++;
                  while (employees[sprayer] == false)
                  {
                      sprayer++;
                      if (sprayer &gt; numEmp)
                      {
                          sprayer = 1;
                      }
                  }
              }
          }
  
          public void Winner()
          {
              if (sprayer == 0)
              {
                  sprayer = 1;
                  System.out.print("\nThe Winner is #" + sprayer);
                  System.out.print("\n");
              }
          }
      }
  </code></pre>
  
  <p>//stack trace for the error message</p>
  
  <pre><code>java.lang.NullPointerException
      at Employee.FillArray(Employee.java:22)
      at Employee.&lt;init&gt;(Employee.java:14)
      at Downsize.main(Downsize.java:9)
  </code></pre>