reading large files in java

Solutions on MaxInterview for reading large files in java by the best coders in the world

showing results for - "reading large files in java"
Mika
27 Jan 2016
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