Print in new line, java
Solution 1:
String newLine = System.getProperty("line.separator");//This will retrieve line separator dependent on OS.
System.out.println("line 1" + newLine + "line2");
Solution 2:
System.out.println("hello"+"\n"+"world");
Solution 3:
Your best shot would be with
String.format("%n")
or
System.out.printf("%n");
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.