title: Java - I get NullPointerException in my program
body: <p>My program will run exept on this Exception:</p>
  
  <p>Here's example:</p>
  
  <pre><code>case 3:
     //display contact    
     cList.displayContacts();    
  
  
   public void displayContacts(){
          int i;
          for(i=0; i &lt; myContacts.length; i++){
              Contact c = myContacts[i];
              System.out.println("Name: " + c.getName());
              System.out.println("Number: " + c.getNumber());
              System.out.println("Email: " + c.getEmail());
              System.out.println("------------------------------------");
          }
      }
  </code></pre>
  
  <p>Exception atlog:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NullPointerException<br>
     at ContactList.displayContacts(ContactList.java:45)
     at ContactListDriver.main(ContactListDriver.java:67)</p>
  </blockquote>