/* * File: TextOutputTest.java * * Character stream output with Writer classes * * Copyright: Northeast Parallel Architectures Center * */ import java.io.IOException; import java.io.FileWriter; import java.io.PrintWriter; public class TextOutputTest { public static void main( String args[] ) throws IOException { String filename = "TextIOTest.dat"; String address[] = { "Northeast Parallel Architectures Center", "111 College Place", "Syracuse University", "Syracuse, NY 13244-4100" }; PrintWriter out = new PrintWriter( new FileWriter( filename ) ); // a character stream System.out.println( "Writing..." ); for ( int i = 0; i < address.length; i++ ) { out.println( address[i] ); } out.close(); } }