Program output to file in Java (and reading it again)
- by Cohagen
I have a large main method in an IO class which creates objects from four different classes in my program (which all use one another to some extent).
My main method takes all info in using a scanner, from the console window, and uses this info to call the constructors and methods in the other classes.
As this is my first full program in Java I have been focussed on making the main method work via the console, without properly considering file input and output.
I cannot see an easy way of making that work now. Ideally what I require is some way of writing everything I input to the console while running the main method to a file, in a format that can be read again and inputed back through the main method?
I have refrained from posting the main method as it is 250+ lines long, but will post any relevant parts of it if required.
Any help appreciated