title: Java and mysql query check if result is empty
body: <pre class="lang-java prettyprint-override"><code>ResultSet zoeken = stat.executeQuery("SELECT * FROM leden WHERE naam = '" + text + "'");
  if (zoeken.getRow() == 0){
     System.out.println("hi");
  }
  while( zoeken.next() ){
     System.out.println(zoeken.getString(1) + zoeken.getString(2) + zoeken.getString(3));
  }
  </code></pre>
  
  <p>I am using this to check if the result <code>zoeken</code> is empty, but it throws an exception saying its illegal to do that regardless if it works or not.</p>
  
  <p>What is a better solution to check if result is empty or not</p>