You are viewing a single comment's thread. Return to all comments →
It's important to note that the '\n' newline character also adds a linefeed at the end. If you do not want the linefeed you should use "%n".
--The Java Tutorial: Formatting
what is line feed ?
line feed mean.
to add a new line
In Java, \r is always carriage return, and \n is line feed.
Why \n and %n both works for this program ?
Can you give an example which helps to understand the difference between them ?
%n is portable between various platforms, the value emmitted from %n will suits underlaying platform, where as value emmitted by \n is same for all the paltforms.