We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here's a breakdown of the format string "%-15s%03d\n":
%-15s: - means left-justified, 15 means minimum width of 15 characters, s means a string value will be inserted here
%03d: 0 means pad with leading zeroes, 3 means minimum width of 3 digits, d means an integer value will be inserted here
\n: newline character
The first argument s1 is a string value to be formatted, and it will be left-justified and padded with spaces to a minimum width of 15 characters.
The second argument x is an integer value to be formatted, and it will be padded with leading zeroes to a minimum width of 3 digits.
Java Output Formatting
You are viewing a single comment's thread. Return to all comments →
Here's a breakdown of the format string "%-15s%03d\n":
%-15s: - means left-justified, 15 means minimum width of 15 characters, s means a string value will be inserted here %03d: 0 means pad with leading zeroes, 3 means minimum width of 3 digits, d means an integer value will be inserted here \n: newline character The first argument s1 is a string value to be formatted, and it will be left-justified and padded with spaces to a minimum width of 15 characters.
The second argument x is an integer value to be formatted, and it will be padded with leading zeroes to a minimum width of 3 digits.