hellreaver
03-31-2009, 05:15 PM
I need to create a Java application that reads lines of text from an input file, infile.txt and copies those lines of text in reverse order to an output file, outfile.txt. I have to use a recursive procedure for reading from the input file and writing to the ouput file.
Given the following input data:
The woods are lovely, dark, and deep,
But I have promises to keep,
And miles to go before I sleep.
And miles to go before I sleep.
the output file should contain:
And miles to go before I sleep.
And miles to go before I sleep.
But I have promises to keep,
The woods are lovely, dark, and deep,
I can set the program up to read the input file, as well as to create the output file, but I am not sure how to reverse the order of the lines... any ideas?
Given the following input data:
The woods are lovely, dark, and deep,
But I have promises to keep,
And miles to go before I sleep.
And miles to go before I sleep.
the output file should contain:
And miles to go before I sleep.
And miles to go before I sleep.
But I have promises to keep,
The woods are lovely, dark, and deep,
I can set the program up to read the input file, as well as to create the output file, but I am not sure how to reverse the order of the lines... any ideas?