Reputation: 399
When writing to a text file in java , how do I enter values into a new line
code snippet
while (rs.next()) {
int sport = rs.getInt("sport");
String name = rs.getString("name");
out.write(sport + " : " + name);}
the text file populates " value1 value2 value3...etc" I want it to populate
value1
value2
value3
.
Upvotes: 4
Views: 13273
Reputation: 61
use out.write(10); to add new line. 10 is acsii character for newline. But it is not work for Indirect/Direct Buffer type FileChannel.
Upvotes: 0
Reputation: 311023
Upvotes: 6