aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference between the printf() and format() methods? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference between the printf() and format() methods?" Watch "Difference between the printf() and format() methods?" New topic
Author

Difference between the printf() and format() methods?

Santiago Bravo
Ranch Hand

Joined: Jul 25, 2008
Posts: 226
What is the difference between the printf() and format() methods?

The API says that printf() is a convenience method to write a formatted string to output.

But why would you use printf() over format()?

Can anyone please elaborate?

Thanks
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

But why would you use printf() over format()?


I wouldnt, since its a convenience method anyway


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
John Sutt
Ranch Hand

Joined: Mar 07, 2008
Posts: 42
I think what is meant here is that the printf method is available, because the function is called like that in another famous programming language (C).
So it's a convenience method for C programmers, who immediately have an idea what this method will do.
For the rest, it's exactly the same as the format() method, I believe.


SCJP 6 (91%), SCJD (91%)
 
 
subject: Difference between the printf() and format() methods?