Skip to content

Instantly share code, notes, and snippets.

@ejknapp
Created January 24, 2011 21:17
Show Gist options
  • Select an option

  • Save ejknapp/793977 to your computer and use it in GitHub Desktop.

Select an option

Save ejknapp/793977 to your computer and use it in GitHub Desktop.
package java112.labs1;
import java.util.*;
import java.io.*;
/**
*@author Eric Knapp class OutputDemo
*@created January 24, 2011
*/
public class OutputDemo {
/**
* Main processing method for the OutputDemo object
*/
public void run() {
PrintWriter out = null;
try {
out = new PrintWriter(
new BufferedWriter(new FileWriter("outputDemo.out")));
out.println();
out.print("Hi, ");
out.println("there");
} catch (java.io.IOException ioException) {
ioException.printStackTrace();
} catch (Exception exception) {
exception.printStackTrace();
} finally {
out.close();
}
}
/**
* The main program for the OutputDemo class
*
*@param args The command line arguments
*/
public static void main(String[] args) {
OutputDemo demo = new OutputDemo();
demo.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment