How to read file in Java? (BufferedReader Example)

Java provides many API to read files , here is once simple example to read a file using Buffered Reader

package com.pretech;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class BufferedReaderExample {
	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new FileReader("c://buffertext.txt"));
		String value;
		while ((value = bf.readLine()) != null) {
			System.out.println(value);
		}
	}
}

No comments:

Post a Comment

Confusion Matrix + Precision/Recall (Super Simple, With Examples)

  Confusion Matrix + Precision/Recall (Super Simple, With Examples) 1) Binary Classification Setup Binary classification means the model p...

Featured Posts