What is the difference between %n and \n in Java?
For example,
System.out.printf("Hello, world! %n");
and
System.out.printf("Hello, world! \n");
Both return the same output for me.
Well, as far as i know the difference is that %n
will always output the correct line break depending on the platform while \n
won't.