I have the following code to print a string (from a ResultSet) into a text file:
PrintWriter writer = new PrintWriter(new FileOutputStream(file, false)); while(RS.next()) { writer.write(RS.getString(1)+"\n"); }
I put "\ n" in the write statement, hoping that it would print each line on a different line, but that failed. Currently, the txt file is printed like this: line # is another line in the ResultSet:
row1row2row3row4row5
I want it printed as:
row1
row2
row3
row4
row5
...
source share