Because a % sign always indicates the start of a format specifier, you must
use "%%" in the format string when you want to output a % character.
public class MainClass {
public static void main(String[] a) {
int percentage = 75;
System.out.printf("\n%1$d%%", percentage);
String str = "The quick brown fox.";
System.out.printf("%nThe string is:%n%s%n%1$25s", str);
}
}
75%
The string is:
The quick brown fox.
The quick brown fox.