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!

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

How do I store the result of `console.readLine` in a variable?

Hi I'm a begginner doing Craig Dennis Java Basics course. Im at task 2 out of 3 and I get this message "Looks like you forgot to store the result of console.readLine in the pastTenseVerb variable." and I'm at a loss. Here's what I've got so far.

String name = console.readLine("Enter your name: "); String adjective = console.readLine("Enter adjective: "); String pastTenseVerb = console.readLine("Enter past tense verb: "); console.printf("%s is very %s and he %s it", name, adjective, pastTenseVerb);

Multiple.java
// I've imported java.io.Console for you.  It is stored in a variable called console for you.
String name = console.readLine("Enter your name:  ");
String adjective = console.readLine("Enter adjective:  ");
String pastTenseVerb = console.readLine("Enter pastTenseVerb:  ");

3 Answers

Jakob Wozniak
Jakob Wozniak
17,896 Points

Haha, I'm not. But he seems like a cool guy.

I tried it again- you need to delete your adjective request in order to pass 2 of 3. On the last exercise, make sure you use console.printf instead of System.out.printf. You should be golden after that!

Thank you, for some reason I thought the adjective.

Have a nice day:D

Jakob Wozniak
Jakob Wozniak
17,896 Points

Hmm... Your code looks fine; I tried it and it worked. Maybe it's because the test is getting confused with your adjective variable? I'd try cutting that if it's still not working.

Hope this helps!

Hi

And thanks for the quick reply, did not work thoug. Works fine in the workspace compiler but I get the error on the Task Challange. Your not by anny chance related to Steve Wozniak are you? :)