"How to Read file Line by line from your system Using java code "
package com.Anand;
/*
* Created by : Anand
* Date: 04-APR-2015
* */
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Reader {
public static void main(String[] args) {
try (
BufferedReader br = new BufferedReader(new FileReader("E:\\Anand.txt")))
{
System.out.println("Read file ok ===> "+br);
String LinebyLine;
while ((LinebyLine = br.readLine()) != null) {
System.out.println("Read file Line by line===> "+LinebyLine);
}
} catch (IOException e) {
e.printStackTrace();
}
}}
/*
* Created by : Anand
* Date: 04-APR-2015
* */
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Reader {
public static void main(String[] args) {
try (
BufferedReader br = new BufferedReader(new FileReader("E:\\Anand.txt")))
{
System.out.println("Read file ok ===> "+br);
String LinebyLine;
while ((LinebyLine = br.readLine()) != null) {
System.out.println("Read file Line by line===> "+LinebyLine);
}
} catch (IOException e) {
e.printStackTrace();
}
}}
Comments
Post a Comment