Reading Text from a File
import java.io.BufferedReader; import java.io.FileReader; public class Main { public static void main(String[] argv) throws Exception { BufferedReader in = new BufferedReader(new FileReader("infilename")); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } }