This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If you read the (admittedly quite long and involved!) javadoc for java.util.Formatter, which is used to implement the format() method, it explains precisely how %s and all other conversions are handled. "%s" is what they call a general conversion. General conversions can be applied to any data type. The Javadoc says about %s that
If the argument arg is null, then the result is "null". If arg implements Formattable, then arg.formatTo is invoked. Otherwise, the result is obtained by invoking arg.toString().
Unboxing is not involved here. [ March 04, 2006: Message edited by: Ernest Friedman-Hill ]