I am stuck on this project that is supposed to accept a text file as an input, reverse the text (ex: Hello there!....!ereht olleH) and then output to another file. So if I run this program using the second file as an input, then text comes back to normal. There are two classes - ReverseLine and a ReverseLineTester. I run it from the CLI (Ex: >ReverseLine File_1) For now it does not work. Any advise? Thanks!
When I tried it, it compiled, ran and created File_2.txt with text identical to the original.
Joined: Oct 13, 2005
By the way, since this is obviously a class exercise, I think you are not supposed to use a StringBuilder to reverse the String. I think you are supposed to use the String method which creates a char array, then create a reverseArray(char) method, probably using a swapPair(char, int, int) method.
Campbell Richie - could you tell me if the file created is in the same directory? Because I've tried looking for that File_2 and could not find it... Yes it is a class project and we are covering File I/O, so we are encouraged to use all things related to it.
Yes, I am somewhat familiar with the Scanner class, however, I have never dealt with the Formatter... Just ran the program... Still can't find the second file
Joined: Nov 29, 2008
Wait a minute... When I run the program and give it File_1 as an argument - nothing happens. (It runs without any errors but does not do anything either) When I run it and give it File_1.txt as an argument, it complains "Invalid variable declaration"