title: Problem with my conditions in Java
body: <p>good day...</p>
  
  <p>i have a problem in searching my entries in my addressbook program... i already search them... but i'm having problem with showing the "Name not found!" message if the name is not yet saved in my addressbook.  Can you help me figure out what's wrong with this...</p>
  
  <pre><code>public void searchEntry() {
  
      int notfound = 0;
      SName = JOptionPane.showInputDialog("Enter Name to find: ");
      for (int i = 0; i &lt; counter; i++) {
          if (entry[i].getName().equals(SName)) {
              JOptionPane.showMessageDialog(null, entry[i].getInfo2());
          }else{
              notfound++;
          }
  
          if (notfound != 0){
              JOptionPane.showMessageDialog(null, "Name Not Found!");
          }
      }
  }
  </code></pre>
  
  <p>Can you help me show the "Name not found" msg... thnx in advance</p>