4 Replies Latest reply on Apr 7, 2008 8:49 PM by abillconsl

    How can I read Line by line a file and compared with my String?

      I m Trying to read a file dictionnaire and try to match each line with a string to see if it the string exist on the file, if yes log the string to another file.
      below is what I get so far...
      public class test {
           public static void main(String[] args) throws IOException {
                String k = "aronas";
                 FileInputStream fstream = new FileInputStream("dictionaryTest.txt");
                 DataInputStream in = new DataInputStream(fstream);
                 BufferedReader br = new BufferedReader(new InputStreamReader(in));
                 String strLine;
                 while ((strLine = br.readLine()) != null)   
                      System.out.println (strLine);
                     if(strLine == k)
                          System.out.println("I'm here");