Intellipaat 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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...