Java Program to Read File using BufferedReader
Example:
import java.io.*;
public class ReadFile {
public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new FileReader("c:\\filename.txt"));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
System.out.println(str);
}
catch (IOException e) {
}
}
}
Output:
*** this is content of the File ***
Share this page on:
Subscribe Email Updates
to get latest update