Java – How to get a platform-dependent new line character

cross-platformeoljavanewline

How do I get a platform-dependent newline in Java? I can’t use "\n" everywhere.

Best Solution

Java 7 now has a System.lineSeparator() method.