Java Java Objects Meet Objects Final

Kortney Field
Kortney Field
13,592 Points

what is %n again?

Just need a explanation reminder of what is %n and how is it different from %s.

1 Answer

Steven Parker
Steven Parker
203,226 Points

Those are both placeholder tokens used in output formatting. The "%s" represents a string to be substituted using a value from another argument, and "%n" represents a line separator (new line).

Steven Parker
Steven Parker
203,226 Points

The online documentation says that "%n" is a platform-independent newline.
"You should always use %n, rather than \n."