
So I want to make a file reader/ buffered reader that reads a new line of the textfile, lets say every 30 second.
Like it reads the first line, waiting 30 seconds, read the next line and so one. Im thinking it might come in handy using tread.sleep()
I've searched but can't seem to find an example
Hope you guys can help me

import java.io.*;
class ReadFileWithTime
{
public static void main(String[] args)
{
try{
FileReader fr=new FileReader("C:/data.txt");
BufferedReader br=new BufferedReader(fr);
String str="";
while((str=br.readLine())!=null){
System.out.println(str);
Thread.sleep(30000);
}
}
catch(Exception e){
System.out.println(e);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.