title: If statement is not working with my swing application
body: <p>I am a java beginner, i wrote this application using netbeans. Its purpose is to get the entered value from the textbox and display it in a message box when i press the button. It works fine when i give the value in the textbox. When i press the button with out giving a value it is suppose to display nothing, but it displays an empty message box. So please help me to fix the problem.</p>
  
  <pre><code>private void ChecktheloopActionPerformed(java.awt.event.ActionEvent evt) {                                             
         String recno= numsearch1.getText();   
         String srname=searchname.getText();
         if(recno!=null){
         JOptionPane.showMessageDialog(null,recno);
     }
  }         
  </code></pre>