I have following code :
System.out.println(" | 1 2 3 4 5 6 7 8 9");
System.out.println("----------------------------");
System.out.println("");
I use println to create a new line. Is it possible to do the same using \n or \r? I tried to add \n to the second println statment and continue printing with the print method but \n does not create a new line.
any ideas?
"\n" this is the simple method to separate the continuous String
It does create a new line. Try:
Your best shot would be with
or
It is supposed to print a newline character, depending on the current platform, so it's perfect for the console.
If you are printing to a file, then it depends.
Since you are on Windows, instead of \n use \r\n (carriage return + line feed).