title: How to delete entry in an Address Book program using Java?
body: <p>I am having trouble with the logic of deleting an entry in an Address Book... I am saving all the entries using an ARRAY.</p>
  
  <p>I am try to make the <code>array[i] = null,</code> if <code>array[i]</code> is equals to the entered name of the user. But after i delete an entry and then try to view all entries again, nothing shows.. and output says :</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NullPointerException<br>
            at AddressBook.viewAll(AddressBook.java:61)<br>
            at AddressBook.main(AddressBook.java:35)<br>
    Java Result: 1    </p>
  </blockquote>
  
  <p>this is my code in deleting an Entry:</p>
  
  <pre><code>public void deleteEntry() {
          SName = JOptionPane.showInputDialog("Enter Name to delete: ");
          for (int i = 0; i &lt; counter; i++) {
              if (entry[i].getName().equals(SName)) {
                  //JOptionPane.showMessageDialog(null, "Found!");
                  entry[i] = null;
              }
          }
      }
  </code></pre>
  
  <p>Can you help me figure out what was wrong with my code... or LOGICAL ERROR?</p>
  
  <p>If you have any suggestion or better way to delete an entry that would be a big help..</p>
  
  <p>please help...</p>