I am reading in words from a file using the following code:
Then I am writing each word scanned into a file with the following code:
The problem is, that when it writes to the output file, it doesn't remember where spaces are or characer returns.. How do I detect a new line character so that the output file looks exactly like the input file? Thanks!!
Code:
scannedWord = scan.next();
System.out.println("word: " + scannedWord);
Code:
FileWriter outFile = new FileWriter(outputFile,true); outFile.write(scannedWord + " "); outFile.close();
Comment