What is the difference between newLine() and carriage return (“\r”)?
Which one is best to use?
File f = new File(strFileGenLoc);
BufferedWriter bw = new BufferedWriter(new FileWriter(f, false));
rs = stmt.executeQuery("select * from jpdata");
while ( rs.next() )
{
bw.write(rs.getString(1)==null? "":rs.getString(1));
bw.newLine();
}
Assuming you mean this:
newLineis environment agnostic\risn’t.So
newLinewill give you\r\non windows but\non another environment.However, you shouldn’t use this in a JTextArea and println will work fine with just
\non windows.Edit now that I’ve seen the code and your comment
In your situation. I think you should use your own constant –
\r\n