Java BufferedReader.readLine()
Syntax
BufferedReader.readLine() has the following syntax.
public String readLine() throws IOException
Example
In the following code shows how to use BufferedReader.readLine() method.
/* w w w . j a v a 2 s.co m*/
import java.io.BufferedReader;
import java.io.FileReader;
public class Main {
public static void main(String[] args) throws Exception {
String thisLine = null;
BufferedReader br = new BufferedReader(new FileReader("c:/test.txt"));
while ((thisLine = br.readLine()) != null) {
System.out.println(thisLine);
}
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »