Is there a Newline constant defined in Java like Environment.Newline in C#?

java

Solution

As of Java 7 (and Android API level 19):

System.lineSeparator()

Documentation: Java Platform SE 7

For older versions of Java, use:

System.getProperty("line.separator");

See https://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html for other properties.

Problem

In C# there is the static property Environment.Newline that changed depending on the running platform. Is there anything similar in Java?

Original source

Related problems