Java: Newline Characters
There are three different major systems for indicating
the end of a line (new line): One for Unix, one for the Macintosh, and
one for DOS/Windows. The '\n' character can be used to represent
the single Unicode character with the value 10 ('\u000A').
Windows programs will sometimes accept this, but often need to use a pair of characters
(carriage return followed by line feed). Use the method below to get the
newline string that is appropriate for your system.
You can get the value for the system your Java
program is running on from the system properties. It is important to
do this with portable programs.
For example,
public static String newline = System.getProperty("line.separator");