Java: Literal percent sign in printf statement

The percent sign is escaped using a percent sign:


The complete syntax can be accessed in java docs. This particular information is in the section Conversions of the first link.

The reason the compiler is generating an error is that only a limited amount of characters may follow a backslash. % is not a valid character.

Leave a Comment