title: Java: How to search files for a keyword?
body: <p>I'm trying to write a function that takes a keyword and searches through a list of files then prints out any of the files that contain the key word.</p>
  
  <p>So far all I have is a list of files and the keyword.</p>
  
  <pre><code>File[] files = new File("&lt;directory&gt;").listFiles();
  Scanner keyword = new Scanner("hello");
  </code></pre>
  
  <p>I think now I need to construct some form of loop that goes through the files looking for the keyword. Any help of even an easy to follow tutorial is appreciated. </p>
  
  <p>edit:</p>
  
  <p>The files are text files that only consist of one line</p>