0

So I was studying about FileReader in java. There we have one method int read(); Once you call this method then second time it gives ASCII value of second character

So After I have read the whole file i want to read it again can I reset it or I have to create a new FileReader Object to read from start?

  FileReader fr=new FileReader("D:\\testout.txt");    
          int i;    
          while((i=fr.read())!=-1)    
          System.out.print((char)i);    
          fr.close();    
  • 1
    May have been answered before: https://stackoverflow.com/questions/30500440/file-handling-reading-from-the-beginning-again – Alan Jun 30 '21 at 20:08

1 Answers1

0

You can create another object and read that file.

FileReader fr2 =new FileReader("D:\\testout.txt");