Message Formatting
Home ] Up ] Files and Directories ] I/O Exceptions ] Streams and Stream Classification ] Character Streams ] Byte Streams ] Data Conversion Streams ] Filter Streams ] [ Message Formatting ] Tokenizers ] Zip & Jar Files ] Random Access ]

 

The Format Family
The printf Family

 

If you've used C/C++ I/O in the past, it may have occurred to you that C's printf is pretty convenient for formatting output.  So you may have asked yourself:  "Is there anything like printf in Java?  How do I gain greater control of formatting my output?"

Before version 5 (1.5) of Java, it wasn't easy.  Java provided a set of classes to allow you to format messages, but they were (and still are) not the easiest things to use.

Fortunately, Java 5/1,5 added the ability to format messages in a way that is much more compatible with C/C++'s printf, that was also available in many other languages.  It is much easier to use, and many people are already familiar with the principles of printf formatting.

 

The page was last updated February 19, 2008