Wednesday, August 12, 2009

How to read text from a file?

Here is the code to read text from the file

try {
BufferedReader in = new BufferedReader(new FileReader("infilename"));
String str;
while ((str = in.readLine()) != null) {
process(str);
}
in.close();
} catch (IOException e) {
}

No comments:

Post a Comment