How do I print my output file?
I have printed the result of my program into an output file.
For some reason I can't figure out how to get the file output.txt to actually print.
I've tried printing it like I would normally print a file but it's not working.
final PrintStream console = System.out;
File file = new File("output.txt");
PrintStream out = new PrintStream(new FileOutputStream(file));
//what do I do after this?
Re: How do I print my output file?
You have opened a FileOutputStream, kept the original System.out (a clever thing to do) and set System.out to another PrintStream that wras your FileOutputStream; you can print to it as always but when you're done you have to close the PrintStream again.