0
What is the difference between System.lineSeparator() and \n? When to use?
2 Answers
0
System.lineSeparator takes into consideration the line separator of the current os. In windows is \n but on IOS and Linux I think it's different, so if you use \n and try to run the program in Linux it may have problems, if you use System.lineSeparator () you don't have to worry about that.
0
In windows, new line is represented by '\r\n' while Linux uses '\n' as newline.
So System.lineSeparator() takes line separator of the current os.