/****************************************************************************** * File : Typer.java * Author : http://java.macteki.com/ * Description : * Display the contents of a text file. ******************************************************************************/ public class Typer { public static void main(String[] args) throws Exception { java.io.BufferedReader br=new java.io.BufferedReader( new java.io.FileReader("Typer.java")); String line=null; while ((line=br.readLine())!=null) { System.out.println(line); } } }
"API belongs to public. Knowledge belongs to yourself."
This blog provides tips and techniques on Java Programming.
You may find demonstration of various computer algorithm written in Java. Most samples are complete and runnable. Readability is of first priority. It should be a easy task to make use of the samples in your own applications.
Friday, March 18, 2011
How to display a text file on console
The following sample type itself to the console.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment