n in java code example
Example 1: %n java
"%n" outputs a line break. A "\n" can also be used in some cases, but since "%n" always outputs the correct platform-specific line separator, it is portable across platforms whereas"\n" is not.
Example 2: how to print \n in a string in java
System.out.println("\\n hello world");
// output:
// "\n hello world"