title: Queue isEmpty Troubleshooting
body: <p>When compliling the program I have no problem but when I try to run the program I get a NullPointerException. I have no clue why I have this and how to get rid of this. </p>
  
  <p>Error is on this line:</p>
  
  <pre><code>public boolean isEmpty(){
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public class TheChair {
      private Customer[] chairQueue = null;
  
      public void TheChair(){
          chairQueue = new Customer[1];
      }
  
      public void enchairQueue( Customer newItem){
          if(chairQueue[0] == null){
              chairQueue[0] = newItem;
          }
          else{
              System.out.println("The chair is full.");
          }
      }
  
      public void dechairQueue(){
          System.out.println(chairQueue[0].getName() + " has left");
          chairQueue[0] = null;
      }
  
      public boolean isEmpty(){
          if(chairQueue[0] == null){
              System.out.println("The Barber's chair is empty");
              System.out.println();
              return true;
          } else{
                  System.out.println("The Barber's chair is filled by: ");
                  System.out.println(chairQueue[0].getName());
                  return false;
          }
      }
  </code></pre>
  
  <p>I'm not really sure how I should troubleshoot this and this is just a small part of code of the program.</p>