title: Beginners Java Blue J returning a String in a method
body: <p>Hi i want my method to search for a book via an id and return the title, the method works perfectly when i printLn but i need it to be returned instead i am getting an error : incompatible types unexpected return value, what do i need to do ? </p>
  
  <p>EDit
  i have now changed the void to string however i am still getting an error : missing return value</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>  public void returnByBookID(int enterBookId)
      {
            Iterator&lt;Book&gt; it = books.iterator();
            while(it.hasNext()) {
            Book books =  it.next();
            if(books.idNumber == (enterBookId)){
  
            return books.title ;
           }
              }
      }
  </code></pre>