printf is a convenience method to write a formatted string to this output stream using the specified format string and arguments.
format - A format string as described in Format string syntax
args - Arguments referenced by the format specifiers in the format string.
In your statement,
System.out.printf("%3s%12s%12s\n", "Sum", "Frequency", "Percentage");
format - %s - indicates your format is a string
If you use "%s%s%s" - It indicates you are going to print 3 string arguments.
%3s%12s%12s indicates that you want to leave spaces before printing arguments
Hence your output would be
Sum Frequency Percentage
Trying printing these:
System.out.printf("%3s%100s%12s\n", "Sum", "Frequency", "Percentage");
You would notice lot of space between first and second arguments
Try doing this:
System.out.printf("%3s%10s\n", "Sum", "Frequency", "Percentage");
You notice that third string "Percentage" is not printed as you have mentioned only two "%s" in the format.