In the JavaOne technical session yesterday, Graham Hamilton mentioned that one of his favorite new features of Java 1.5 is the return of printf. Here! Here! As a long time C programmer I have always found that trying to output nicely formatted columns of numbers from Java to be awkward, requiring DecimalFormat objects, and manual padding of strings. A very unsatisfying experience. Now with the revival of printf, all of those old C skills for controlling output are useful again. Woot!


Well, I don't mind having printf again, and I didn't mind using java.text for years. Both has it's advantages. I'm jsut sad how many times I had to convert C printf for years to Java, cause Sun took so long to include it. Actually I still have to, since baseline is jdk1.4.2 :-(

Posted by Frank Nestel on June 29, 2004 at 07:54 AM EDT #

Yes, I still have to wait too until 1.5 (or 5.0, whatever it is called), is everywhere (win32, solaris, linux OS X). Still, it is good to know it is in the pipeline.

Posted by Paul on June 29, 2004 at 08:02 AM EDT #

If you want printf before going to 1.5 take a look at

Posted by MIke on June 29, 2004 at 10:31 AM EDT #

Or you can check out free and open-source version of the sprintf() at

Posted by Unknown on June 30, 2004 at 04:12 AM EDT #

Yes, I've seen that there are actually printf's for Java. But I avoid depending on too many libraries. It's also annoying that we have many log libraries and many regexp libaries (and many printf ones) cause Sun hesitated to include one itself. It's good to have alternatives, for example if need something faster, but not too many. With JAXP it wen't quite nicely, you have a standard API, but many tools which support in and are "pluggable". It's good to have DOM4J or XOM now, but those are for specialists and have their own focus.

Posted by Frank Nestel on June 30, 2004 at 10:03 AM EDT #

hee hee. it's only a matter of time now till java adds memory management functions like malloc and free... then the subjugation of c++ will be complete, lol.

Posted by ac on June 30, 2004 at 01:42 PM EDT #

Ac .. heh ... oh and Java will have to drop all trailing letter 'e's from the word 'create'.

Posted by Paul on June 30, 2004 at 01:55 PM EDT #

Post a Comment:
Comments are closed for this entry.

This blog copyright 2010 by plamere