Nope. Java currently has very limited support for operator overloading, and this is not one of those cases.
The %
in the string literal is handled by the implementation of java.util.Formatter
. String#format
and PrintWriter#printf
delegate the formatting work to Formatter
, which manually parses the string.
The only reason % has value there is due to how Formatter
handles the string.
If you view the code, you'll find:
if (conversion == '%' || conversion == 'n')
followed by a switch statement which handles the different types.