How do I get a platform-dependent newline in Java? I can’t use \"\\n\" everywhere.
\"\\n\"
The commons-lang library has a constant field available called SystemUtils.LINE_SEPARATOR
This is also possible: String.format("%n").
String.format("%n")
Or String.format("%n").intern() to save some bytes.
String.format("%n").intern()
You can use
System.getProperty("line.separator");
to get the line separator