File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java Interview Guide
this week in the
Programmer Certification (SCJP/OCPJP)
Regarding System.out.printf method
Swapnil Suryakant Prabhavalkar
Joined: Feb 25, 2012
Mar 31, 2012 07:24:04
Is System.out.printf method is in syllabus for
I came across a question in Devaka's examlab software. I am not able to understand the syntax of this method.
The question was:
What would be the output of System.out.printf("12%1$s","13%1$s","14%1$s");
I have seen that output comes out to be 1213%1$s but didn't get how.
Could you please explain me?
Oracle Certified Professional, Java SE 6 Programmer (81%), Oracle Certified Expert, Java EE 6 Web Component Developer (87%)
Joined: Apr 06, 2010
Mar 31, 2012 07:49:21
It used to be included - you'd have to check the current syllabus to be sure. Anyway, the explanation of how format strings work is found in the
class documentation (follow the link).
I agree. Here's the link:
subject: Regarding System.out.printf method
Please explain the output of this: This question is from ExamLabs Diagnostic Test
Formatting boolean, string with incompatible data types
printf string formatting
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015