Duplicate methods in java.io.Console?

There java.io.Console

are two methods, printf

and format

, which look the same. The API says:

Calling this view method con.printf(format, args)

behaves exactly the same as callingcon.format(format, args)

So why are there two methods? Is there a case where you prefer?

EDIT: they did it in java.io.PrintStream as well as in Java 5

+3


source to share


2 answers


This is for a programmer who comes from different programming sources. C/ C++

usesprintf



+3


source


Calling this form method con.printf(format, args)

behaves exactly the same as calling con.format(format, args)

- Documentation



So there is no difference, but just for syntax convenience

+2


source







All Articles