ProAnswers.org

What is Java Format Class?

Formatter class outputs the formatted output. It can format numbers, strings, and time and date. It operates in a manner similar to the C/C++ printf() function.

Syntax

 

The most commonly used format function is:

 

Formatter format(String fmtString, Object ... args)

 

Note

 

The fmtSring consists characters that are copied to the output buffer and the format specifiers.

A format specifier begins with a percent sign followed by the format conversion specifier. For example, the format specifier for floating-point data is %f 

The format specifiers and the arguments are matched in order from left to right.