Before we move on to the code, first create a text file (input.txt) using notepad?
package javaapplication1; import java.io.*; public class JavaApplication1 { public static void main(String args[]) { FileReader fr = null; BufferedReader br = null; try{ fr = new FileReader("input.txt"); br = new BufferedReader(fr); String line = br.readLine(); while(line != null){ System.out.println(line); line = br.readLine(); } } catch(IOException ieox){ System.out.println(ieox); } } }
Comments
Post a Comment