Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKyle Dudley
604 Pointsum what
how gelp pls
// I've imported java.io.Console for you. It is stored in a variable called console for you.
String name = console.readLine("What is your name? ");
String pastTenseVerb = console.readLine("What is your past tense verb? ");
console.printf(name, "%s really %s", pastTenseVerb,"%s this coding exercise%s ");
1 Answer
Simon Coates
28,694 Pointsit's:
String name = console.readLine("What is your name? ");
String pastTenseVerb = console.readLine("What is your past tense verb? ");
console.printf("%s really %s this coding exercise%s ", name, pastTenseVerb);
the parameters for printf are the string with placeholders, then the values to be used to replace the placeholders
Kyle Dudley
604 PointsKyle Dudley
604 PointsIt worked! TY
Simon Coates
28,694 PointsSimon Coates
28,694 PointsIf something is kinda awry, you can always look online at the documentation. In this instance, the Console class has a method with a signature of printf(String format, Object... args), implying that the first argument is the format string and then it accepts an arbitrary number of parameters after that for use. If you're only just starting out, the use of "..." in a method signature might be unfamiliar.