Created
September 20, 2011 21:07
-
-
Save ejknapp/1230344 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package java112.labs1; | |
import java.io.*; | |
/** | |
* @author Eric Knapp | |
* class DemoOutput | |
* | |
*/ | |
public class DemoOutput { | |
public void run() { | |
PrintWriter out = null; | |
try { | |
out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt", true))); | |
writeSomeStuff(out); | |
} catch (IOException ioException) { | |
ioException.printStackTrace(); | |
} catch (Exception exception) { | |
exception.printStackTrace(); | |
} finally { | |
try { | |
if (out != null){ | |
out.close(); | |
} | |
} catch (Exception exception) { | |
exception.printStackTrace(); | |
} | |
} | |
} | |
private void writeSomeStuff(PrintWriter out) { | |
out.println("Hi."); | |
} | |
public static void main(String[] args) { | |
DemoOutput lab = new DemoOutput(); | |
lab.run(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment