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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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