What's wrong with the following statement: System.out.printf(object.toString())?

John Zukowski

The first argument to the printf method is the formatting string. While this will typically display the string you want, if it includes something like a % in it, it won't and will try to interpret the following characters as formatting related, then look for an argument to format. A better way to use printf to print something is to pass in a first argument of the string "%s".

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.