title: Find a word in a File and print the line that contains it in java
body: <p>Using command line, I am supposed to enter a file name that contains text and search for a specific word.</p>
  
  <blockquote>
    <p>foobar file.txt</p>
  </blockquote>
  
  <p>I started writing the following code:</p>
  
  <pre><code>import java.util.*;
  import java.io.*;
  
  class Find {
      public static void main (String [] args) throws FileNotFoundException {
          String word = args[0];
          Scanner input = new Scanner (new File (args[1]) );
          while (input.hasNext()) {
              String x = input.nextLine();    
          }
      }
  }
  </code></pre>
  
  <p>My program is supposed to find word and then print the whole line that contains it.
  Please be specific since I am new to java.</p>