title: java source code class
body: <p>Can anyone help to advise what I am doing wrong. I am trying to search a class for objects by year but if there are no matches I want a statement to print out that there are no matches but its not working it just is printing out even if the year is found. Thanks in advance for help</p>
  
  <pre><code>   //search by year 
  
      public void searchByYear(int year){
          for(Book s : books){
              if(s.getYear()==year){
                  System.out.println(s.toString());
              }
          }System.out.println("No match");
      }
  </code></pre>