<div style='background-color: none transparent;'></div>
Home » » Java read file line by line

Java read file line by line

import java.io.*;

public class ReadFile {
public static void main(String[] args) throws Exception {

File f = new File("C:/Hello.txt");
if (!f.exists() && f.length() < 0) {
System.out.println("The specified file does not exist");
} else {
FileReader fr = new FileReader(f);
BufferedReader reader = new BufferedReader(fr);
String st = "";
while ((st = reader.readLine()) != null) {
System.out.println(st);
}
}
}
}
Share this article :
 
Copyright © 2011. B.Sc B.Tech MCA Ploytechnic Mini,Main Projects | Free Main Projcets Download | MCA |B.tech . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template Modify by Creating Website. Inpire by Darkmatter Rockettheme Proudly powered by Blogger