Program output to file in Java (and reading it again)

Posted by Cohagen on Stack Overflow See other posts from Stack Overflow or by Cohagen
Published on 2012-12-06T23:02:10Z Indexed on 2012/12/06 23:03 UTC
Read the original article Hit count: 116

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about file