Reader & Writer Streams in Advanced Java Programming

import java.io.BufferedReader;
import java.io.FileReader;

public class Main {
  public static void main(String[] args) throws Exception{
    String srcFile = "test.txt";
    BufferedReader br = new BufferedReader(new FileReader(srcFile));
    String text = null;

    while ((text = br.readLine()) != null) {
      System.out.println(text);
    }
    br.close();
  }
}




No comments:

Post a Comment