read text files in java with bufferedreader

Solutions on MaxInterview for read text files in java with bufferedreader by the best coders in the world

showing results for - "read text files in java with bufferedreader"
Lennard
04 Sep 2017
1import java.io.*;
2
3public class FileReaderWithBufferedReader {
4
5    public static void main(String[] args) throws IOException{We
6        String file = "src/file.txt";
7        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
8
9        String curLine;
10        while ((curLine = bufferedReader.readLine()) != null){
11            //process the line as required
12            System.out.println(curLine);
13        }
14        bufferedReader.close();
15    }
16}
17