What is the difference between newLine() and carriage return (\"\\r\")?
Which one is best to use?
File f = new File(strFileGenLoc);
BufferedWrit
the major newLine(\n) and carriage return (\r) is :
new line(\n) & carriage return (\r) both r escape sequence in java..
new line(\n):
when ever \n is found in executable statements,the JVM splits the line into 2 parts from where we placed \n (escape sequence)..
example :
println("Stackover\nflow");
output:
Stackover // here the line got split into 2 lines because of "\n"
flow
carriage return (\r):
the data or character placed after the \r get overtire with the previous characters present in the same line ...
example :
println("Stackover\rflow");
output:
flow // here Statckover is overtired because of "\r"