System.out.printf vs System.out.format

Rollerball picture Rollerball · Apr 26, 2013 · Viewed 20.1k times · Source

Are System.out.printf and System.out.format totally the same or perhaps they differ in somehow?

Answer

NilsH picture NilsH · Apr 26, 2013

System.out is a PrintStream, and quoting the javadoc for PrintStream.printf

An invocation of this method of the form out.printf(l, format, args) behaves in exactly the same way as the invocation out.format(l, format, args)