I have a code like,
String str = \" \" ;
while( cond ) {
str = str + \"\\n\" ;
}
Now, I don\'t know why at the time of printing, the out
Looks like you are trying to run the above code on Windows. Well the line separator or new line is different on Windows ( '\r\n' ) and Unix flavors ('\n').
So, instead of hard coding and using '\n' as new line. Try getting new line from the system like:
String newLine = System.getProperty("line.separator");
String str = " " ;
while( cond ) {
str = str + newLine ;
}