Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.9k points)

In C# there is the static property Environment.Newline that changed depending on the running platform.

Is there anything similar in Java?

1 Answer

0 votes
by (46k points)

As of Java 7:

System.lineSeparator()

Java API : System.lineSeparator

Returns the system-dependent line separator string. It always returns the same value - the initial value of the system property line.separator. On UNIX systems, it returns "\n"; on Microsoft Windows systems it returns "\r\n".

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 15, 2019 in Java by Nigam (4k points)
0 votes
1 answer
asked Sep 24, 2019 in Java by Anvi (10.2k points)

Browse Categories

...