Conclusion and Resources
Getting a grasp of all the formatting options available with
Formatter will take a little time, unless you are
familiar with them from the C world. Some minor
differences exist, but for the most part the
behaviors are very similar. One key difference with the Java platform is that when the
formatting string is invalid, an exception will be thrown.
Be sure to take a long look at the formatting strings
available, as shown in the
Formatter class Javadoc.
When creating your own custom classes, not only should you provide a
toString() implementation, but implementing
Formattable interface will typically be
- Download the J2SE 1.5 Beta 1 from the Sun Developer Network.
- Download the source code examples used in this article.
- Check out the 1.5.0 Javadocs to learn about what's new:
- Formatter class
- Formattable interface
- Appendable interface
- String class
- StringBuilder class
- PrintStream class
- Learn about "Formatting numbers and currency" (developerWorks, August 2003) from an earlier Magic with Merlin column.
- Try the "Getting started with new I/O (NIO)" (developerWorks, July 2003) tutorial to learn more about the NIO libraries.
- Examine the progress of Tiger (J2SE 1.5) with JSR 176.
- Email bug reports to Sun at email@example.com.
- Read the complete set of Taming Tiger tips from John Zukowski. And if you're still working with J2SE 1.4, you'll want to read Magic with Merlin series, too.
- Find hundreds more Java technology resources on the developerWorks Java technology zone.
- Visit the Developer Bookstore for a comprehensive listing of technical books, including hundreds of Java-related titles.