Formatted String Output

Support for formatted output was introduced with JDK 1.1, in package java.text. There is a class called java.text.DecimalFormat for formatting numbers, and a class DateFormat for formatting dates and times. Other classes provide support for collation (sorting order), and formatting program messages to users.

Most people now will prefer to use the standard formatting used in C and printf, available from JDK 1.5 in class java.util.Formatter. Please refer to the Chapter 17 for a description of these features.

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.