String template = "%s and '%'";
String result = String.format(template, "my string");
System.out.println(result);
预期:
my string and '%'
但结果是:
java.util.UnknownFormatConversionException: Conversion = '''
为什么?如何正确声明序列'%'
以使其被忽略String.format()
?