File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes System.out.format( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "System.out.format( "%s", new Integer( 123 ));" Watch "System.out.format( "%s", new Integer( 123 ));" New topic
Author

System.out.format( "%s", new Integer( 123 ));

joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117


Although the argument is of type Integer and %s siginifies String why does the above work?

Can someone please explain the concept behind all this.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Integer.toString will be called.
Same as System.out.println( new Integer(123) );


[My Blog]
All roads lead to JavaRanch
joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: System.out.format( "%s", new Integer( 123 ));