title: why to use resultset!=null does it check for null
body: <p>I have following code </p>
  
  <pre><code>if (rs != null)
  {
    out.println("result set has got something");
    while (rs.next())
    { 
      //I am processing result set now
    }
  }
  else
  {
    out.println("result set is empty");
  }
  </code></pre>
  
  <p>Even though rs is null it is printing <strong>"resultset has got something"</strong>. Why is it happening like that and  how can I check for empty result set?</p>