Read text file using BufferedReader - Java File Path IO

Java examples for File Path IO:BufferedReader

Description

Read text file using BufferedReader

Demo Code

package FilesManipulations;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;


public class ReadTxt {

    public static void main(String[] args) {

        try (BufferedReader br = new BufferedReader(new FileReader(
                "testing.txt"))) {

            String sCurrentLine;//from ww  w  . j  a va  2 s. co  m

            while ((sCurrentLine = br.readLine()) != null) {
                System.out.println(sCurrentLine);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

Related Tutorials