All pastes #432427 Raw Edit

FileOutput_Monmouth

public java v1 · immutable
·published 2007-04-10 07:13 UTC
rendered paste body
import java.io.*; class FileOutputDemo { 	public static void main(String args[]) { 		FileOutputStream out; 		// declare a file output object 		PrintStream p; 		// declare a print stream object 		try { 			// Create a new file output stream 			// connected to "myfile.txt" 			out = new FileOutputStream("myfile.txt"); 			// Connect print stream to the output stream 			p = new PrintStream( out ); p.println ("This is written to a file"); 			p.close(); 			} 		catch (Exception e) { 			System.err.println ("Error writing to file"); 		}	} 	}