Need to Allow User to Input an Error Message and Example Code is Printed
<p>I need a user to input an error message that will flag example code in a text file and then print it back out to the user. Right now I have the program reading the text file with the error messages in it. My question is how will I allow the user to get the error code they want. How can I get the the user inputed error to compare to the text file and print it back out? Here is what I have so far:</p>

<pre><code>import java.io.*;

class FileRead 
{
 public static void main(String args[])
  {
  try{

  // Open the file that is the first 
  // command line parameter
  FileInputStream fstream = new FileInputStream("javaerrors.txt");

  // Get the object of DataInputStream  
  DataInputStream in = new DataInputStream(fstream);
  BufferedReader br = new BufferedReader(new InputStreamReader(in));
  String strLine;

  //Read File Line By Line
  while ((strLine = br.readLine()) != null)   {

  // Print the content on the console
  System.out.println (strLine);

  }

  //Close the input stream
  in.close();

     }

  catch (Exception e){//Catch exception if any
  System.err.println("Error: " + e.getMessage());
  }
  }
}
</code></pre>
