What is the difference between MessageFormat.format
and String.format
in JDK 1.5?
String.format is just a shortcut to Formatter, this is a "printf-style" formatter. On the other side, MessageFormat uses a different formatting convention, as described in the linked documentation.
Use the first "for layout justification and alignment, common formats for numeric, string, and date/time data, and locale-specific output" and the second "to produce concatenated messages in language-neutral way".