difference between MessageFormat.format and String.format in jdk1.5?
问题 What is the difference between MessageFormat.format and String.format in JDK 1.5? 回答1: Put simply, the main difference is in format string: MessageFormat.format() format string accepts argument positions (eg. {0} , {1} ). Example: "This is year {0}!" The developer doesn't have to worry about argument types, because they are, most often, recognized and formated according to current Locale . String.format() format string accepts argument type specifiers (eg. %d for numbers, %s for strings).