wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes About String.format() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About String.format()" Watch "About String.format()" New topic
Author

About String.format()

kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
Hi all,

i was going through a blog on java.
I got the guy using String.format().

I could not get why he was using this.

if i write this


Both will give same result i.e. 1.

Is java people included this because of giving feel of c/c++?

Is there any important role of this method?

Thanks,
Kaya.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Check out the API docs for the Formatter class to get a better understanding of the method.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40041
    
  28
Also, it produces Strings similar in format to what is described here in the Java™ Tutorials
Roy Paterson
Smart Bear Support
Greenhorn

Joined: Jul 07, 2009
Posts: 6
In the example you gave, yes it is pointless. However String.format(...) is capable of much more complicated and useful stuff.


Smart Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About String.format()