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 trialTed Clayton
Courses Plus Student 206 PointsOutput a sentence that takes both the noun and past tense verb using a single statement. It should look like this:
Output a sentence that takes both the noun and past tense verb using a single statement. It should look like this: name really past tense verb this exercise.
// 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 a past tense verb to describe you? ");
console.printf("%s really %s this coding exercise. ");
2 Answers
Steve Hunter
57,712 PointsHi Ted,
You've put two placeholders in your string which is where the values held by your two variables will be inserted. You just need to add the two variable names, in order, after the output string:
console.printf("%s really %s this coding exercise.", name, pastTenseVerb);
So, the value held in name
will be inserted at the first %s
and the value in pastTenseVerb
will appear at the second %s
.
I hope that makes sense.
Steve.
Ted Clayton
Courses Plus Student 206 PointsSteve, Thank you for the help man I appreciate it.
All the best, Ted