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 trial

Java Java Basics Using your New Tools Multiple Format Strings

Create a new variable to store a past tense verb, so in camel case that is pastTenseVerb. Accept input from the console

Create a new variable to store a past tense verb, so in camel case that is pastTenseVerb. Accept input from the console using the readLine method.

Multiple.java
String pastTenseVerb = console.readLine("Enter a verb in a past tense:  ");
console.printf("%s", pastTenseVerb);

4 Answers

Michael Hess
Michael Hess
24,512 Points

Hi James,

It looks like there is not a String variable called name that excepts console input. Please see the following code snippet:

// I've imported java.io.Console for you.  It is stored in a variable called console for you.


String name = console.readLine("Enter a verb in a past tense:  ");
String pastTenseVerb = console.readLine("Enter a verb in a past tense:  "); 
console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

If you have any questions -- don't hesitate to ask them! Hope this helps!

thnx you plz and Output a sentence that takes both the name and past tense verb using a single statement. It should look like this: name really past tense verb this coding exercise.

Michael Hess
Michael Hess
24,512 Points

If you're getting that message you need to type this in your console.printf statement

console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

It won't let you pass if you type this

console.printf("%s %s ", name, pastTenseVerb);

thnx bro i'm very happy :D

Question was : Output a sentence that takes both the name and past tense verb using a single statement. It should look like this: name really past tense verb this coding exercise.

My Answer:

String name = console.readLine("Enter name"); String pastTenseVerb = console.readLine("Enter Past Tense Verb"); console.printf("name %s past tense verb %s ",name, pastTenseVerb );

Although I was writing the correct answer it was not letting me get through the 3rd step.

AFter looking at this post in help, console.printf("%s really %s this coding exercise.", name, pastTenseVerb); seems to get me through this problem.

But I really feel they should fix this problem. It is very annoying to have to get the error message when I am right.