>>1312215If it doesn't have to happen at the same time, you can store all the output you print in a StringBuilder and then write the StringBuilder contents to file when your Computer Program completes.
If it has to be at the same time then you can do the same trick, but append lines to the bottom of the file as you get them and set the length of the StringBuilder to 0 after each write to the file.
That would be a little more effort to make, but not a large amount. It would make your program slower though.
If you want you can make your own method that takes a String and does both of these actions.
You can refactor that into a static class for printing called MaidPrinter or something along those lines and then you can have a field for the filename, and a method for printing that takes your string and prints it on the console and puts it in a file.
Call it statically from wherever you need it.
>MaidPrinter.print("Good Morning Dra/g/on Maids!);If you need more help tell me and I will make a demo implementation because I think this trick of saving a history file of console input-output to a text file sounds like a nice addition to a REPL and REPL is a type of programming environment I make a lot of times.