UnknownFormatConversionException is caused by symbol '%' in String.format()
问题 String template = "%s and '%'"; String result = String.format(template, "my string"); System.out.println(result); Expected : my string and '%' But result is : java.util.UnknownFormatConversionException: Conversion = ''' Why? How to correctly declared the sequence '%' so that it's ignored by String.format() ? 回答1: % is already used by format specifiers so it requires an additional % to display that character: String template = "%s and '%%'"; 来源: https://stackoverflow.com/questions/16713396